[submodule "external/bockbuild"]
path = external/bockbuild
url = git://github.com/mono/bockbuild.git
+[submodule "external/linker"]
+ path = external/linker
+ url = git://github.com/mono/linker.git
{
"name": "ms-test-suite",
"url": "git@github.com:xamarin/ms-test-suite.git",
- "rev": "eb7cd709549bffe170653a50805f1593d66ea81e",
+ "rev": "55b6637eb1de61c743323ec82db1e0cadfee5b32",
"remote-branch": "origin/master",
"branch": "master",
"directory": "ms-test-suite"
"branch": "master",
"directory": "benchmarker"
}
-]
+]
\ No newline at end of file
check-ms-test-suite:
@if $(MAKE) validate-ms-test-suite RESET_VERSIONS=1; then \
- $(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug -t:library -warn:1 -r:nunit.framework" && \
- $(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-console.exe -nologo -exclude=MonoBug,BadTest" NUNIT_XML_RESULT=$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml || EXIT_CODE=1; \
+ $(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug -t:library -warn:1 -r:nunitlite.dll" && \
+ $(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml" || EXIT_CODE=1; \
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup build MCS="$(MCS) -debug -warn:1" && \
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup run MONO="$(RUNTIME)" || EXIT_CODE=1; \
exit $$EXIT_CODE; \
win_files = \
eglib-config.hw \
gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
- gmodule-win32.c gtimer-win32.c
+ gmodule-win32.c gtimer-win32.c gunicode-win32.c
unix_files = \
gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
}
return FALSE;
}
+
+gchar *
+g_mkdtemp (char *tmp_template)
+{
+ char *template_copy = g_strdup (tmp_template);
+
+ return mkdtemp (template_copy);
+}
#define g_ascii_strtod strtod
#define g_ascii_isalnum isalnum
-#ifdef WIN32
gchar *g_mkdtemp (gchar *tmpl);
-#else
-#define g_mkdtemp mkdtemp
-#endif
/*
* Pattern matching
--- /dev/null
+/*
+ * gmisc-win32-uwp.c: UWP misc support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <assert.h>
+
+gchar*
+g_win32_getlocale(void)
+{
+ gunichar2 buf[19];
+ gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9);
+ assert (ccBuf <= 9);
+ if (ccBuf != 0) {
+ buf[ccBuf - 1] = L'-';
+ ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+ assert (ccBuf <= 9);
+ }
+
+ // Check for GetLocaleInfoEx failure.
+ if (ccBuf == 0)
+ buf[0] = L'\0';
+
+ return u16to8 (buf);
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gmisc_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
return g_strdup (buf);
}
-
-#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-
-gchar*
-g_win32_getlocale(void)
-{
- gunichar2 buf[19];
- gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9);
- assert (ccBuf <= 9);
- if (ccBuf != 0) {
- buf[ccBuf - 1] = L'-';
- ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
- assert (ccBuf <= 9);
- }
-
- // Check for GetLocaleInfoEx failure.
- if (ccBuf == 0)
- buf[0] = L'\0';
-
- return u16to8 (buf);
-}
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
gboolean
return FALSE;
}
-const gchar *
-g_get_home_dir (void)
-{
- gchar *home_dir = NULL;
-
#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static gchar*
+g_get_known_folder_path (void)
+{
+ gchar *folder_path = NULL;
PWSTR profile_path = NULL;
HRESULT hr = SHGetKnownFolderPath (&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &profile_path);
if (SUCCEEDED(hr)) {
- home_dir = u16to8 (profile_path);
+ folder_path = u16to8 (profile_path);
CoTaskMemFree (profile_path);
}
+
+ return folder_path;
+}
+
+#else
+
+static inline gchar *
+g_get_known_folder_path (void)
+{
+ return NULL;
+}
#endif
+const gchar *
+g_get_home_dir (void)
+{
+ gchar *home_dir = g_get_known_folder_path ();
+
if (!home_dir) {
home_dir = (gchar *) g_getenv ("USERPROFILE");
}
--- /dev/null
+#ifndef __G_MODULE_WINDOWS_INTERNALS_H__
+#define __G_MODULE_WINDOWS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef G_OS_WIN32
+#include <gmodule.h>
+
+gpointer
+w32_find_symbol (const gchar *symbol_name);
+#endif /* G_OS_WIN32 */
+#endif /* __G_MODULE_WINDOWS_INTERNALS_H__ */
--- /dev/null
+/*
+ * gmodule-win32-uwp.c: UWP gmodule support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <gmodule-win32-internals.h>
+
+gpointer
+w32_find_symbol (const gchar *symbol_name)
+{
+ g_unsupported_api ("EnumProcessModules");
+ SetLastError (ERROR_NOT_SUPPORTED);
+ return NULL;
+}
+
+const gchar *
+g_module_error (void)
+{
+ gchar *ret = NULL;
+ TCHAR buf [1024];
+ DWORD code = GetLastError ();
+
+ if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
+ code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS (buf) - 1, NULL) )
+ buf[0] = TEXT('\0');
+
+ ret = u16to8 (buf);
+ return ret;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gmodule_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
*/
#include <config.h>
#include <glib.h>
-#include <gmodule.h>
#include <windows.h>
#include <psapi.h>
+#include <gmodule-win32-internals.h>
#define LIBSUFFIX ".dll"
#define LIBPREFIX ""
}
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-static gpointer
+gpointer
w32_find_symbol (const gchar *symbol_name)
{
HMODULE *modules;
g_free (modules);
return NULL;
}
-
-#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-
-static gpointer
-w32_find_symbol (const gchar *symbol_name)
-{
- g_unsupported_api ("EnumProcessModules");
- SetLastError (ERROR_NOT_SUPPORTED);
- return NULL;
-}
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
gboolean
return ret;
}
-
-#elif G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-
-const gchar *
-g_module_error (void)
-{
- gchar* ret = NULL;
- TCHAR buf[1024];
- DWORD code = GetLastError ();
-
- if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
- code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS(buf) - 1, NULL) )
- buf[0] = TEXT('\0');
-
- ret = u16to8 (buf);
- return ret;
-}
-
-#else
-
-const gchar *
-g_module_error (void)
-{
- g_unsupported_api ("FormatMessage");
- SetLastError (ERROR_NOT_SUPPORTED);
- return NULL;
-}
-
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
gboolean
--- /dev/null
+/*
+ * gunicode-win32-uwp.c: UWP unicode support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#define CODESET 1
+#include <windows.h>
+
+extern const char *my_charset;
+static gboolean is_utf8;
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+ if (my_charset == NULL) {
+ static char buf [14];
+ CPINFOEXA cp_info;
+
+ GetCPInfoExA (CP_ACP, 0, &cp_info);
+ sprintf (buf, "CP%u", cp_info.CodePage);
+ my_charset = buf;
+ is_utf8 = FALSE;
+ }
+
+ if (charset != NULL)
+ *charset = my_charset;
+
+ return is_utf8;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gunicode_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
--- /dev/null
+/*
+ * gunicode-win32.c: Windows unicode support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#define CODESET 1
+#include <windows.h>
+
+extern const char *my_charset;
+static gboolean is_utf8;
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+ if (my_charset == NULL) {
+ static char buf [14];
+ sprintf (buf, "CP%u", GetACP ());
+ my_charset = buf;
+ is_utf8 = FALSE;
+ }
+
+ if (charset != NULL)
+ *charset = my_charset;
+
+ return is_utf8;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_mono_gunicode_win32_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
#include <unicode-data.h>
#include <errno.h>
-#if defined(_MSC_VER) || defined(G_OS_WIN32)
-/* FIXME */
-# define CODESET 1
-# include <windows.h>
-#else
+#ifndef G_OS_WIN32
# ifdef HAVE_LOCALCHARSET_H
# include <localcharset.h>
# endif
#endif
-static const char *my_charset;
-static gboolean is_utf8;
+const char *my_charset;
/*
* Character set conversion
return res;
}
-#ifdef G_OS_WIN32
-extern WINBASEAPI UINT WINAPI GetACP(void);
-gboolean
-g_get_charset (G_CONST_RETURN char **charset)
-{
- if (my_charset == NULL) {
- static char buf [14];
-#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
- CPINFOEXA cp_info;
- GetCPInfoExA (CP_ACP, 0, &cp_info);
- sprintf (buf, "CP%u", cp_info.CodePage);
-#else
- sprintf (buf, "CP%u", GetACP ());
-#endif
- my_charset = buf;
- is_utf8 = FALSE;
- }
-
- if (charset != NULL)
- *charset = my_charset;
-
- return is_utf8;
-}
-
-#else /* G_OS_WIN32 */
+#ifndef G_OS_WIN32
+static gboolean is_utf8;
gboolean
g_get_charset (G_CONST_RETURN char **charset)
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 1
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+ #error Unsupported WINAPI family
+#endif
#else
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 0
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+ #error Unsupported WINAPI family
+#endif
#endif
#endif
--- /dev/null
+Subproject commit e4d9784ac37b9ebf4757175c92bc7a3ec9fd867a
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
public void SetMetadata (string metadataName,
string metadataValue,
bool treatMetadataValueAsLiteral)
+ {
+ SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral, false);
+ }
+
+ void SetMetadata (string metadataName,
+ string metadataValue,
+ bool treatMetadataValueAsLiteral,
+ bool fromDynamicItem)
{
if (metadataName == null)
throw new ArgumentNullException ("metadataName");
} else if (HasParentItem) {
if (parent_item.child_items.Count > 1)
SplitParentItem ();
- parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral);
+ parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral, fromDynamicItem);
}
- if (FromXml || HasParentItem) {
+
+ // We don't want to reevalute the project for dynamic items
+ if (!fromDynamicItem && !IsDynamic && (FromXml || HasParentItem)) {
parent_item_group.ParentProject.MarkProjectAsDirty ();
parent_item_group.ParentProject.NeedToReevaluate ();
}
continue;
foreach (string name in evaluatedMetadata.Keys) {
- item.SetMetadata (name, (string)evaluatedMetadata [name]);
+ item.SetMetadata (name, (string)evaluatedMetadata [name], false, IsDynamic);
}
AddAndRemoveMetadata (project, item);
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
</Project>", "D");
}
+ [Test]
+ public void ItemGroupInsideTarget_UpdateMetadata ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <ProjectReference Include='xyz'/>
+ </ItemGroup>
+
+ <Target Name='Main' DependsOnTargets='CreateBar'>
+ <Message Text='Before: $(Bar)'/>
+ <ItemGroup>
+ <ProjectReference>
+ <AdditionalProperties>A=b</AdditionalProperties>
+ </ProjectReference>
+ </ItemGroup>
+ <Message Text='After: $(Bar)'/>
+ </Target>
+
+ <Target Name='CreateBar'>
+ <PropertyGroup>
+ <Bar>Bar01</Bar>
+ </PropertyGroup>
+ </Target>
+ </Project>", 2, "Before: Bar01", "After: Bar01");
+ }
+
[Test]
public void ItemGroupInsideTarget_Batching ()
{
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
throw new Win32Exception (err);
}
} else {
- int iPtr = buffer.ToInt32 ();
+ IntPtr iPtr = buffer;
services = new ServiceController [servicesReturned];
for (int i = 0; i < servicesReturned; i++) {
ENUM_SERVICE_STATUS serviceStatus = (ENUM_SERVICE_STATUS) Marshal.PtrToStructure (
- new IntPtr (iPtr), typeof (ENUM_SERVICE_STATUS));
+ iPtr, typeof (ENUM_SERVICE_STATUS));
// TODO: use internal ctor that takes displayname too ?
services [i] = new ServiceController (serviceStatus.pServiceName,
machineName);
// move on to the next services
- iPtr += ENUM_SERVICE_STATUS.SizeOf;
+ iPtr = IntPtr.Add(iPtr, ENUM_SERVICE_STATUS.SizeOf);
}
// we're done, so exit the loop
throw new Win32Exception (err);
}
} else {
- int iPtr = buffer.ToInt32 ();
+ IntPtr iPtr = buffer;
services = new ServiceController [servicesReturned];
for (int i = 0; i < servicesReturned; i++) {
ENUM_SERVICE_STATUS_PROCESS serviceStatus = (ENUM_SERVICE_STATUS_PROCESS) Marshal.PtrToStructure (
- new IntPtr (iPtr), typeof (ENUM_SERVICE_STATUS_PROCESS));
+ iPtr, typeof (ENUM_SERVICE_STATUS_PROCESS));
// TODO: use internal ctor that takes displayname too
services [i] = new ServiceController (serviceStatus.pServiceName,
machineName);
// move on to the next services
- iPtr += ENUM_SERVICE_STATUS_PROCESS.SizeOf;
+ iPtr = IntPtr.Add(iPtr, ENUM_SERVICE_STATUS_PROCESS.SizeOf);
}
// we're done, so exit the loop
// - Start
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.ServiceProcess;
using TimeoutException = System.ServiceProcess.TimeoutException;
[TestFixture]
public class ServiceControllerTest
{
+ class ServiceInfo
+ {
+ public string ServiceName;
+ public string DisplayName;
+ public ServiceType ServiceType = ServiceType.Win32ShareProcess;
+ public string[] Dependents = new string[] {};
+ public string[] DependedOn = new string[] {};
+ }
+
+ static ServiceInfo DISK_DRIVER_SERVICE = new ServiceInfo { ServiceName = "disk", DisplayName = "Disk Driver", ServiceType = ServiceType.KernelDriver };
+ static ServiceInfo ROUTING_AND_REMOTE_ACCESS_SERVICE = new ServiceInfo { ServiceName = "RemoteAccess", DisplayName = "Routing and Remote Access", DependedOn = new [] { "bfe", "http", "rasman", "rpcss" } };
+ static ServiceInfo SECONDARY_LOGON_SERVICE = new ServiceInfo { ServiceName = "seclogon", DisplayName = "Secondary Logon", Dependents = new [] { "te.service" } };
+ static ServiceInfo SECURITY_ACCOUNTS_MANAGER_SERVICE = new ServiceInfo { ServiceName = "SamSs", DisplayName = "Security Accounts Manager", Dependents = new [] { "browser", "ktmrm", "lanmanserver", "msdtc" }, DependedOn = new [] { "rpcss" } };
+ static ServiceInfo WINDOWS_IMAGE_ACQUISITION_SERVICE = new ServiceInfo { ServiceName = "stisvc", DisplayName = "Windows Image Acquisition (WIA)", ServiceType = ServiceType.Win32OwnProcess, DependedOn = new [] { "rpcss" } };
+ static ServiceInfo WINDOWS_SEARCH_SERVICE = new ServiceInfo { ServiceName = "WSearch", DisplayName = "Windows Search", ServiceType = ServiceType.Win32OwnProcess, Dependents = new [] { "wmpnetworksvc", "workfolderssvc" }, DependedOn = new [] { "rpcss" } };
+ static ServiceInfo WINDOWS_TIME_SERVICE = new ServiceInfo { ServiceName = "W32Time", DisplayName = "Windows Time" };
+ static ServiceInfo WINDOWS_UPDATE_SERVICE = new ServiceInfo { ServiceName = "wuauserv", DisplayName = "Windows Update", DependedOn = new [] { "rpcss" } };
+ static ServiceInfo WORKSTATION_SERVICE = new ServiceInfo { ServiceName = "LanmanWorkstation", DisplayName = "Workstation", Dependents = new [] { "browser", "netlogon", "sessionenv" }, DependedOn = new [] { "bowser", "mrxsmb20", "nsi" } };
+
+ // A service which is expected to be disabled by default on all supported Windows versions.
+ static ServiceInfo DISABLED_SERVICE = ROUTING_AND_REMOTE_ACCESS_SERVICE;
+ // A service which is running by default and can be stopped/paused by the current user when running with admin rights.
+ static ServiceInfo CONTROLLABLE_SERVICE = WINDOWS_IMAGE_ACQUISITION_SERVICE;
+ // A service which cannot be stopped/paused.
+ static ServiceInfo UNCONTROLLABLE_SERVICE = SECURITY_ACCOUNTS_MANAGER_SERVICE;
+ // A service with ServiceType == KernelDriver
+ static ServiceInfo KERNEL_SERVICE = DISK_DRIVER_SERVICE;
+ // A service with ServiceType == Win32ShareProcess.
+ static ServiceInfo SHARE_PROCESS_SERVICE = WORKSTATION_SERVICE;
+
+ static ServiceInfo SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON = SECURITY_ACCOUNTS_MANAGER_SERVICE;
+ static ServiceInfo SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON = WINDOWS_SEARCH_SERVICE;
+ static ServiceInfo SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON = WORKSTATION_SERVICE;
+
+ static ServiceInfo SERVICE_WITH_MANY_DEPENDENTS = WORKSTATION_SERVICE;
+ static ServiceInfo SERVICE_WITH_ONE_DEPENDENT = SECONDARY_LOGON_SERVICE;
+ static ServiceInfo SERVICE_WITH_NO_DEPENDENTS = WINDOWS_TIME_SERVICE;
+
+ static ServiceInfo SERVICE_WITH_MANY_DEPENDED_ON = WORKSTATION_SERVICE;
+ static ServiceInfo SERVICE_WITH_ONE_DEPENDED_ON = WINDOWS_UPDATE_SERVICE;
+ static ServiceInfo SERVICE_WITH_NO_DEPENDED_ON = WINDOWS_TIME_SERVICE;
+
+ [TestFixtureSetUp]
+ public void FixtureSetUp ()
+ {
+ try {
+ EnsureServiceIsRunning (new ServiceController (CONTROLLABLE_SERVICE.ServiceName));
+ } catch {
+ Assert.Ignore ($"Failed to start the service '{CONTROLLABLE_SERVICE.DisplayName}'. Ensure you are running the tests with admin privileges.");
+ }
+ }
+
[Test]
public void Constructor1 ()
{
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("lanmanworkstation");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName);
Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
Assert.IsTrue (sc.CanShutdown, "#B1");
ServiceController [] dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#D1");
- Assert.IsTrue (dependentServices.Length > 1, "#D2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.Dependents, ServiceNames (dependentServices), "#D2");
Assert.IsNotNull (sc.DisplayName, "#E1");
- Assert.AreEqual ("Workstation", sc.DisplayName, "#E2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.DisplayName, sc.DisplayName, "#E2");
Assert.IsNotNull (sc.MachineName, "#F1");
Assert.AreEqual (".", sc.MachineName, "#F2");
sc.Refresh ();
Assert.IsNotNull (sc.ServiceName, "#G1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#G2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceName, sc.ServiceName, "#G2");
ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#H1");
- Assert.AreEqual (0, servicesDependedOn.Length, "#H2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.DependedOn, ServiceNames (servicesDependedOn), "#H2");
- Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#I1");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceType, sc.ServiceType, "#I1");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#J1");
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("workstation");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.DisplayName);
Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
Assert.IsTrue (sc.CanShutdown, "#B1");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("lanmanworkstation");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName);
Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
Assert.IsTrue (sc.CanShutdown, "#B1");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("lanmanworkstation",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
Environment.MachineName);
Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
ServiceController [] dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#D1");
- Assert.IsTrue (dependentServices.Length > 1, "#D2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.Dependents, ServiceNames (dependentServices), "#D2");
Assert.IsNotNull (sc.DisplayName, "#E1");
- Assert.AreEqual ("Workstation", sc.DisplayName, "#E2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.DisplayName, sc.DisplayName, "#E2");
Assert.IsNotNull (sc.MachineName, "#F1");
Assert.AreEqual (Environment.MachineName, sc.MachineName, "#F2");
sc.Refresh ();
Assert.IsNotNull (sc.ServiceName, "#G1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#G2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceName, sc.ServiceName, "#G2");
ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#H1");
- Assert.AreEqual (0, servicesDependedOn.Length, "#H2");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.DependedOn, ServiceNames (servicesDependedOn), "#H2");
- Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#I1");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceType, sc.ServiceType, "#I1");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#J1");
}
public void Constructor3_MachineName_Empty ()
{
try {
- new ServiceController ("alerter", string.Empty);
+ new ServiceController (CONTROLLABLE_SERVICE.ServiceName, string.Empty);
Assert.Fail ("#1");
} catch (ArgumentException ex) {
// MachineName value is invalid
public void Constructor3_MachineName_Null ()
{
try {
- new ServiceController ("alerter", null);
+ new ServiceController (CONTROLLABLE_SERVICE.ServiceName, null);
Assert.Fail ("#1");
} catch (ArgumentException ex) {
// MachineName value is invalid
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.IsTrue (sc.CanPauseAndContinue, "#1");
- sc.ServiceName = "SamSs";
+ sc.ServiceName = UNCONTROLLABLE_SERVICE.ServiceName;
Assert.IsFalse (sc.CanPauseAndContinue, "#2");
- sc.DisplayName = "Workstation";
+ sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
Assert.IsTrue (sc.CanPauseAndContinue, "#3");
sc.MachineName = "doesnotexist";
try {
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
bool canPauseAndContinue = sc.CanPauseAndContinue;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("NetDDE", ".");
+ ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.IsFalse (sc1.CanPauseAndContinue);
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("SamSs", ".");
+ ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
Assert.IsFalse (sc1.CanPauseAndContinue);
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#1");
Assert.IsTrue (sc.CanPauseAndContinue, "#2");
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.IsTrue (sc.CanShutdown, "#1");
- sc.ServiceName = "SamSs";
+ sc.ServiceName = UNCONTROLLABLE_SERVICE.ServiceName;
Assert.IsFalse (sc.CanShutdown, "#2");
- sc.DisplayName = "Workstation";
+ sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
Assert.IsTrue (sc.CanShutdown, "#3");
sc.MachineName = "doesnotexist";
try {
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
bool canShutdown = sc.CanShutdown;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("NetDDE", ".");
+ ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.IsFalse (sc1.CanShutdown);
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("SamSs", ".");
+ ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
Assert.IsFalse (sc1.CanShutdown);
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#1");
Assert.IsTrue (sc.CanShutdown, "#2");
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.IsTrue (sc.CanStop, "#1");
- sc.ServiceName = "SamSs";
+ sc.ServiceName = UNCONTROLLABLE_SERVICE.ServiceName;
Assert.IsFalse (sc.CanStop, "#2");
- sc.DisplayName = "Workstation";
+ sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
Assert.IsTrue (sc.CanStop, "#3");
sc.MachineName = "doesnotexist";
try {
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
bool canStop = sc.CanStop;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("NetDDE", ".");
+ ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.IsFalse (sc1.CanStop);
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("SamSs", ".");
+ ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
Assert.IsFalse (sc1.CanStop);
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#1");
Assert.IsTrue (sc.CanStop, "#2");
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
sc.Continue ();
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("NetDDE", ".");
- ServiceController sc2 = new ServiceController ("NetDDE", ".");
+ ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
// Cannot resume NetDDE service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("NetDDE") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (DISABLED_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("SamSs", ".");
- ServiceController sc2 = new ServiceController ("SamSs", ".");
+ ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
sc1.Continue ();
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot resume SamSs service on computer '.'
+ // Cannot resume service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("SamSs") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (UNCONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
sc1.Continue ();
Assert.Fail ("#D1");
} catch (InvalidOperationException ex) {
- // Cannot resume Schedule service on computer '.'
+ // Cannot resume the service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
Assert.IsNotNull (ex.Message, "#D3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
Assert.IsNotNull (ex.InnerException, "#D6");
ServiceController [] dependentServices = null;
// single dependent service
- sc = new ServiceController ("dmserver", ".");
+ sc = new ServiceController (SERVICE_WITH_ONE_DEPENDENT.ServiceName, ".");
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#A1");
Assert.AreEqual (1, dependentServices.Length, "#A2");
- Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#A3");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#A3");
// modifying ServiceName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.ServiceName = "alerter";
+ sc.ServiceName = SERVICE_WITH_NO_DEPENDENTS.ServiceName;
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#B1");
Assert.AreEqual (1, dependentServices.Length, "#B2");
- Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#B3");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#B3");
// modifying DisplayName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.DisplayName = "Spooler";
+ sc.DisplayName = SERVICE_WITH_MANY_DEPENDENTS.DisplayName;
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#C1");
Assert.AreEqual (1, dependentServices.Length, "#C2");
- Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#C3");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#C3");
// modifying MachineName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
sc.MachineName = "doesnotexist";
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#D1");
- Assert.AreEqual (1, dependentServices.Length, "#D2");
- Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#D3");
+ Assert.AreEqual (1, dependentServices.Length, "#D");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#D3");
// no dependent services
- sc = new ServiceController ("alerter", ".");
+ sc = new ServiceController (SERVICE_WITH_NO_DEPENDENTS.ServiceName, ".");
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#E1");
Assert.AreEqual (0, dependentServices.Length, "#E2");
// modifying ServiceName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.ServiceName = "dmserver";
+ sc.ServiceName = SERVICE_WITH_MANY_DEPENDENTS.ServiceName;
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#F1");
Assert.AreEqual (0, dependentServices.Length, "#F2");
// modifying DisplayName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.DisplayName = "Workstation";
+ sc.DisplayName = SERVICE_WITH_ONE_DEPENDENT.DisplayName;
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#G1");
Assert.AreEqual (0, dependentServices.Length, "#G2");
Assert.AreEqual (0, dependentServices.Length, "#H2");
// multiple dependent services
- sc = new ServiceController ("TapiSrv", ".");
+ sc = new ServiceController (SERVICE_WITH_MANY_DEPENDENTS.ServiceName, ".");
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#I1");
- Assert.AreEqual (2, dependentServices.Length, "#I2");
- Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#I3");
- Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#I4");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#I2");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#I3");
// modifying ServiceName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.ServiceName = "spooler";
+ sc.ServiceName = SERVICE_WITH_NO_DEPENDENTS.ServiceName;
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#J1");
- Assert.AreEqual (2, dependentServices.Length, "#J3");
- Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#J4");
- Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#J5");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#J3");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#J3");
// modifying DisplayName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.DisplayName = "Alerter";
+ sc.DisplayName = SERVICE_WITH_ONE_DEPENDENT.DisplayName;
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#K1");
- Assert.AreEqual (2, dependentServices.Length, "#K2");
- Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#K3");
- Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#K4");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#K2");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#K3");
// modifying MachineName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
sc.MachineName = Environment.MachineName;
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#L1");
- Assert.AreEqual (2, dependentServices.Length, "#L2");
- Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#L3");
- Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#L4");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#L2");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#L3");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("dmserver",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
ServiceController [] dependenServices = sc.DependentServices;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("NetDDE", ".");
+ ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
ServiceController [] dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#1");
- Assert.AreEqual (1, dependentServices.Length, "#2");
- Assert.AreEqual ("ClipSrv", dependentServices [0].ServiceName, "#3");
+ Assert.AreEqual (DISABLED_SERVICE.Dependents, ServiceNames (dependentServices), "#2");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
+ var s1 = WORKSTATION_SERVICE;
+ var s2 = WINDOWS_SEARCH_SERVICE;
+
ServiceController sc = new ServiceController ();
- sc.DisplayName = "workstation";
- Assert.AreEqual ("workstation", sc.DisplayName, "#A1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
+ sc.DisplayName = s1.DisplayName.ToLower ();
+ Assert.AreEqual (s1.DisplayName.ToLower (), sc.DisplayName, "#A1");
+ Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#A2");
- sc.DisplayName = "alerter";
- Assert.AreEqual ("alerter", sc.DisplayName, "#B1");
- Assert.AreEqual ("Alerter", sc.ServiceName, "#B2");
+ sc.DisplayName = s2.DisplayName.ToLower ();
+ Assert.AreEqual (s2.DisplayName.ToLower (), sc.DisplayName, "#B1");
+ Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#B2");
- sc = new ServiceController ("workstation");
- sc.DisplayName = "alerter";
- Assert.AreEqual ("alerter", sc.DisplayName, "#C1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#C2");
- Assert.AreEqual ("workstation", sc.DisplayName, "#C3");
+ sc = new ServiceController (s1.DisplayName.ToLower ());
+ sc.DisplayName = s2.DisplayName.ToLower ();
+ Assert.AreEqual (s2.DisplayName.ToLower (), sc.DisplayName, "#C1");
+ Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#C2");
+ Assert.AreEqual (s1.DisplayName.ToLower (), sc.DisplayName, "#C3");
- sc.DisplayName = "alerter";
- Assert.AreEqual ("alerter", sc.DisplayName, "#D1");
- Assert.AreEqual ("Alerter", sc.ServiceName, "#D2");
+ sc.DisplayName = s2.DisplayName.ToLower ();
+ Assert.AreEqual (s2.DisplayName.ToLower (), sc.DisplayName, "#D1");
+ Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#D2");
- sc.DisplayName = "workstation";
- Assert.AreEqual ("workstation", sc.DisplayName, "#E1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#E2");
+ sc.DisplayName = s1.DisplayName;
+ Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#E1");
+ Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#E2");
- sc = new ServiceController ("workstation");
- Assert.AreEqual ("workstation", sc.DisplayName, "#F1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#F2");
+ sc = new ServiceController (s1.DisplayName.ToLower ());
+ Assert.AreEqual (s1.DisplayName.ToLower (), sc.DisplayName, "#F1");
+ Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#F2");
- sc.DisplayName = "Workstation";
- Assert.AreEqual ("Workstation", sc.DisplayName, "#G1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#G2");
+ sc.DisplayName = s1.DisplayName;
+ Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#G1");
+ Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#G2");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("dmserver",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
string displayName = sc.DisplayName;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("NetDDE", ".");
- Assert.AreEqual ("Network DDE", sc.DisplayName);
+ ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+ Assert.AreEqual (DISABLED_SERVICE.DisplayName, sc.DisplayName);
}
[Test]
Assert.Ignore ("Running on Unix.");
ServiceController sc = new ServiceController ();
- sc.DisplayName = "workstation";
- Assert.AreEqual ("workstation", sc.DisplayName, "#A1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
+ sc.DisplayName = WORKSTATION_SERVICE.DisplayName.ToLower ();
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName.ToLower (), sc.DisplayName, "#A1");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#A2");
}
[Test]
Assert.AreEqual (string.Empty, sc.DisplayName, "#A1");
Assert.AreEqual (string.Empty, sc.ServiceName, "#A2");
- sc.DisplayName = "WorkStation";
+ sc.DisplayName = WORKSTATION_SERVICE.DisplayName;
- Assert.AreEqual ("WorkStation", sc.DisplayName, "#B1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#B2");
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#B1");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#B2");
sc.DisplayName = string.Empty;
Assert.Ignore ("Running on Unix.");
ServiceController sc = new ServiceController ();
- sc.DisplayName = "Alerter";
+ sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
try {
sc.DisplayName = null;
Assert.Fail ("#1");
Assert.AreEqual ("value", ex.ParamName, "#5");
Assert.IsNull (ex.InnerException, "#6");
}
- Assert.AreEqual ("Alerter", sc.DisplayName, "#7");
+ Assert.AreEqual (CONTROLLABLE_SERVICE.DisplayName, sc.DisplayName, "#7");
}
[Test]
Assert.Ignore ("Running on Unix.");
ServiceController sc = new ServiceController ();
- sc.DisplayName = "lanmanworkstation";
- Assert.AreEqual ("lanmanworkstation", sc.DisplayName, "#A1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
- Assert.AreEqual ("Workstation", sc.DisplayName, "#A3");
+ sc.DisplayName = WORKSTATION_SERVICE.ServiceName;
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.DisplayName, "#A1");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#A2");
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#A3");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Disk", ".");
+ ServiceController sc = new ServiceController (DISK_DRIVER_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
try {
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_CONTINUE);
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_DEVICEEVENT);
Assert.Fail ("#C1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
Assert.IsNotNull (ex.InnerException, "#C6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_HARDWAREPROFILECHANGE);
Assert.Fail ("#D1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
Assert.IsNotNull (ex.Message, "#D3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#D4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#D4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
Assert.IsNotNull (ex.InnerException, "#D6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_INTERROGATE);
Assert.Fail ("#E1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
Assert.IsNotNull (ex.Message, "#E3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#E4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#E4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#E5");
Assert.IsNotNull (ex.InnerException, "#E6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDADD);
Assert.Fail ("#F1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
Assert.IsNotNull (ex.Message, "#F3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#F4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#F4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#F5");
Assert.IsNotNull (ex.InnerException, "#F6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDDISABLE);
Assert.Fail ("#G1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#G2");
Assert.IsNotNull (ex.Message, "#G3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#G4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#G4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#G5");
Assert.IsNotNull (ex.InnerException, "#G6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDENABLE);
Assert.Fail ("#H1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#H2");
Assert.IsNotNull (ex.Message, "#H3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#H4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#H4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#H5");
Assert.IsNotNull (ex.InnerException, "#H6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDREMOVE);
Assert.Fail ("#I1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#I2");
Assert.IsNotNull (ex.Message, "#I3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#I4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#I4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#I5");
Assert.IsNotNull (ex.InnerException, "#I6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PARAMCHANGE);
Assert.Fail ("#J1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#J2");
Assert.IsNotNull (ex.Message, "#J3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#J4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#J4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#J5");
Assert.IsNotNull (ex.InnerException, "#J6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PAUSE);
Assert.Fail ("#K1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#K2");
Assert.IsNotNull (ex.Message, "#K3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#K4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#K4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#K5");
Assert.IsNotNull (ex.InnerException, "#K6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_POWEREVENT);
Assert.Fail ("#L1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#L2");
Assert.IsNotNull (ex.Message, "#L3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#L4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#L4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#L5");
Assert.IsNotNull (ex.InnerException, "#L6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SESSIONCHANGE);
Assert.Fail ("#M1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#M2");
Assert.IsNotNull (ex.Message, "#M3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#M4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#M4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#M5");
Assert.IsNotNull (ex.InnerException, "#M6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SHUTDOWN);
Assert.Fail ("#N1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#N2");
Assert.IsNotNull (ex.Message, "#N3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#N4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#N4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#N5");
Assert.IsNotNull (ex.InnerException, "#N6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_STOP);
Assert.Fail ("#O1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#O2");
Assert.IsNotNull (ex.Message, "#O3");
- Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#O4");
+ Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#O4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#O5");
Assert.IsNotNull (ex.InnerException, "#O6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PAUSE);
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
try {
sc.ExecuteCommand (127);
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
sc.ExecuteCommand (256);
Assert.Fail ("#C1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
Assert.IsNotNull (ex.InnerException, "#C6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
sc.Pause ();
sc.ExecuteCommand (127);
Assert.Fail ("#C1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
Assert.IsNotNull (ex.InnerException, "#C6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
try {
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_CONTINUE);
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_DEVICEEVENT);
Assert.Fail ("#C1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
Assert.IsNotNull (ex.InnerException, "#C6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_HARDWAREPROFILECHANGE);
Assert.Fail ("#D1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
Assert.IsNotNull (ex.Message, "#D3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
Assert.IsNotNull (ex.InnerException, "#D6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_INTERROGATE);
Assert.Fail ("#E1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
Assert.IsNotNull (ex.Message, "#E3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#E4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#E4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#E5");
Assert.IsNotNull (ex.InnerException, "#E6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDADD);
Assert.Fail ("#F1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
Assert.IsNotNull (ex.Message, "#F3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#F4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#F4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#F5");
Assert.IsNotNull (ex.InnerException, "#F6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDDISABLE);
Assert.Fail ("#G1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#G2");
Assert.IsNotNull (ex.Message, "#G3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#G4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#G4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#G5");
Assert.IsNotNull (ex.InnerException, "#G6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDENABLE);
Assert.Fail ("#H1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#H2");
Assert.IsNotNull (ex.Message, "#H3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#H4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#H4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#H5");
Assert.IsNotNull (ex.InnerException, "#H6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDREMOVE);
Assert.Fail ("#I1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#I2");
Assert.IsNotNull (ex.Message, "#I3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#I4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#I4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#I5");
Assert.IsNotNull (ex.InnerException, "#I6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PARAMCHANGE);
Assert.Fail ("#J1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#J2");
Assert.IsNotNull (ex.Message, "#J3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#J4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#J4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#J5");
Assert.IsNotNull (ex.InnerException, "#J6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PAUSE);
Assert.Fail ("#K1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#K2");
Assert.IsNotNull (ex.Message, "#K3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#K4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#K4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#K5");
Assert.IsNotNull (ex.InnerException, "#K6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_POWEREVENT);
Assert.Fail ("#L1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#L2");
Assert.IsNotNull (ex.Message, "#L3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#L4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#L4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#L5");
Assert.IsNotNull (ex.InnerException, "#L6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SESSIONCHANGE);
Assert.Fail ("#M1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#M2");
Assert.IsNotNull (ex.Message, "#M3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#M4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#M4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#M5");
Assert.IsNotNull (ex.InnerException, "#M6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SHUTDOWN);
Assert.Fail ("#N1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#N2");
Assert.IsNotNull (ex.Message, "#N3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#N4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#N4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#N5");
Assert.IsNotNull (ex.InnerException, "#N6");
sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_STOP);
Assert.Fail ("#O1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#O2");
Assert.IsNotNull (ex.Message, "#O3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#O4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#O4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#O5");
Assert.IsNotNull (ex.InnerException, "#O6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
sc.Pause ();
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
sc.Pause ();
sc.ExecuteCommand (127);
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
sc.Stop ();
sc.ExecuteCommand (127);
Assert.Fail ("#C1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
Assert.IsNotNull (ex.InnerException, "#C6");
sc.ExecuteCommand (128);
Assert.Fail ("#D1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
Assert.IsNotNull (ex.Message, "#D3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
Assert.IsNotNull (ex.InnerException, "#D6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
sc.Stop ();
sc.ExecuteCommand (127);
Assert.Fail ("#C1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#C3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
Assert.IsNotNull (ex.InnerException, "#C6");
sc.ExecuteCommand (128);
Assert.Fail ("#D1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
Assert.IsNotNull (ex.Message, "#D3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
Assert.IsNotNull (ex.InnerException, "#D6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule", ".");
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
sc.Stop ();
sc.ExecuteCommand (127);
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
sc.ExecuteCommand (128);
Assert.Fail ("#C1");
} catch (InvalidOperationException ex) {
- // Cannot control Schedule service on computer '.'
+ // Cannot control XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
Assert.IsNotNull (ex.InnerException, "#C6");
devices = ServiceController.GetDevices ();
Assert.IsNotNull (devices, "#A1");
- bool foundDisk = false;
- bool foundAlerter = false;
+ bool foundKernelService = false;
+ bool foundShareProcessService = false;
foreach (ServiceController sc in devices) {
- switch (sc.ServiceName) {
- case "Disk":
- Assert.AreEqual ("Disk Driver", sc.DisplayName, "#A2");
+ if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+ Assert.AreEqual (KERNEL_SERVICE.DisplayName, sc.DisplayName, "#A2");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A3");
- foundDisk = true;
- break;
- case "Alerter":
- foundAlerter = true;
- break;
+ foundKernelService = true;
+ } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+ foundShareProcessService = true;
}
}
- Assert.IsTrue (foundDisk, "#A4");
- Assert.IsFalse (foundAlerter, "#A5");
+ Assert.IsTrue (foundKernelService, "#A4");
+ Assert.IsFalse (foundShareProcessService, "#A5");
devices = ServiceController.GetDevices (Environment.MachineName);
Assert.IsNotNull (devices, "#B1");
- foundDisk = false;
- foundAlerter = false;
+ foundKernelService = false;
+ foundShareProcessService = false;
foreach (ServiceController sc in devices) {
- switch (sc.ServiceName) {
- case "Disk":
- Assert.AreEqual ("Disk Driver", sc.DisplayName, "#B2");
+ if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+ Assert.AreEqual (KERNEL_SERVICE.DisplayName, sc.DisplayName, "#B2");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#B3");
- foundDisk = true;
- break;
- case "Alerter":
- foundAlerter = true;
- break;
+ foundKernelService = true;
+ } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+ foundShareProcessService = true;
}
}
- Assert.IsTrue (foundDisk, "#B4");
- Assert.IsFalse (foundAlerter, "#B5");
+ Assert.IsTrue (foundKernelService, "#B4");
+ Assert.IsFalse (foundShareProcessService, "#B5");
}
[Test]
services = ServiceController.GetServices ();
Assert.IsNotNull (services, "#A1");
- bool foundDisk = false;
- bool foundWorkstation = false;
+ bool foundKernelService = false;
+ bool foundShareProcessService = false;
foreach (ServiceController sc in services) {
- switch (sc.ServiceName) {
- case "Disk":
- foundDisk = true;
- break;
- case "lanmanworkstation":
- foundWorkstation = true;
- break;
+ if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+ foundKernelService = true;
+ } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+ foundShareProcessService = true;
}
}
- Assert.IsFalse (foundDisk, "#A4");
- Assert.IsTrue (foundWorkstation, "#A5");
+ Assert.IsFalse (foundKernelService, "#A4");
+ Assert.IsTrue (foundShareProcessService, "#A5");
services = ServiceController.GetServices (Environment.MachineName);
Assert.IsNotNull (services, "#B1");
- foundDisk = false;
- foundWorkstation = false;
+ foundKernelService = false;
+ foundShareProcessService = false;
foreach (ServiceController sc in services) {
- switch (sc.ServiceName) {
- case "Disk":
- foundDisk = true;
- break;
- case "lanmanworkstation":
- Assert.AreEqual ("Workstation", sc.DisplayName, "#B2");
+ if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+ foundKernelService = true;
+ } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+ Assert.AreEqual (SHARE_PROCESS_SERVICE.DisplayName, sc.DisplayName, "#B2");
Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#B3");
- foundWorkstation = true;
- break;
+ foundShareProcessService = true;
}
}
- Assert.IsFalse (foundDisk, "#B4");
- Assert.IsTrue (foundWorkstation, "#B5");
+ Assert.IsFalse (foundKernelService, "#B4");
+ Assert.IsTrue (foundShareProcessService, "#B5");
}
[Test]
Assert.Ignore ("Running on Unix.");
ServiceController sc = new ServiceController ();
- sc.ServiceName = "alerter";
- Assert.AreEqual ("Alerter", sc.DisplayName, "#A1");
+ sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#A1");
Assert.AreEqual (".", sc.MachineName, "#A2");
- Assert.AreEqual ("alerter", sc.ServiceName, "#A3");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#A3");
sc.MachineName = Environment.MachineName;
- Assert.AreEqual ("Alerter", sc.DisplayName, "#B1");
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#B1");
Assert.AreEqual (Environment.MachineName, sc.MachineName, "#B2");
- Assert.AreEqual ("alerter", sc.ServiceName, "#B3");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#B3");
sc.MachineName = "doesnotexist";
- Assert.AreEqual ("Alerter", sc.DisplayName, "#C1");
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#C1");
Assert.AreEqual ("doesnotexist", sc.MachineName, "#C2");
- Assert.AreEqual ("alerter", sc.ServiceName, "#C3");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#C3");
sc.MachineName = "DoesNotExist";
- Assert.AreEqual ("Alerter", sc.DisplayName, "#D1");
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#D1");
Assert.AreEqual ("DoesNotExist", sc.MachineName, "#D2");
- Assert.AreEqual ("alerter", sc.ServiceName, "#D3");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#D3");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
sc.Pause ();
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("NetDDE", ".");
- ServiceController sc2 = new ServiceController ("NetDDE", ".");
+ ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
// Cannot pause NetDDE service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("NetDDE") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (DISABLED_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("SamSs", ".");
- ServiceController sc2 = new ServiceController ("SamSs", ".");
+ ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
sc1.Pause ();
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot pause SamSs service on computer '.'
+ // Cannot pause XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("SamSs") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (UNCONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
sc1.Pause ();
Assert.Fail ("#D1");
} catch (InvalidOperationException ex) {
- // Cannot pause Schedule service on computer '.'
+ // Cannot pause XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
Assert.IsNotNull (ex.Message, "#D3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
Assert.IsNotNull (ex.InnerException, "#D6");
ServiceController [] dependentServices = null;
ServiceController [] servicesDependedOn = null;
- sc = new ServiceController ("NetDDE", ".");
+ sc = new ServiceController (SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON.ServiceName, ".");
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#A1");
- Assert.AreEqual (1, dependentServices.Length, "#A2");
- Assert.AreEqual ("ClipSrv", dependentServices [0].ServiceName, "#A3");
+ Assert.AreEqual (SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON.Dependents, ServiceNames (dependentServices), "#A2");
servicesDependedOn = sc.ServicesDependedOn;
- Assert.IsNotNull (servicesDependedOn, "#A4");
- Assert.AreEqual (1, servicesDependedOn.Length, "#A5");
- Assert.AreEqual ("NetDDEDSDM", servicesDependedOn [0].ServiceName, "#A6");
+ Assert.AreEqual (SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#A3");
- sc.ServiceName = "rasman";
+ sc.ServiceName = SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON.ServiceName;
sc.Refresh ();
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#B1");
- Assert.AreEqual (1, dependentServices.Length, "#B2");
- Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#B3");
+ Assert.AreEqual (SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON.Dependents, ServiceNames (dependentServices), "#B2");
servicesDependedOn = sc.ServicesDependedOn;
- Assert.IsNotNull (servicesDependedOn, "#B4");
- Assert.AreEqual (1, servicesDependedOn.Length, "#B5");
- Assert.AreEqual ("Tapisrv", servicesDependedOn [0].ServiceName, "#B6");
+ Assert.IsNotNull (servicesDependedOn, "#B3");
+ Assert.AreEqual (SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#A4");
- sc.DisplayName = "NetDDE";
+ sc.DisplayName = SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON.ServiceName;
sc.Refresh ();
dependentServices = sc.DependentServices;
Assert.IsNotNull (dependentServices, "#C1");
- Assert.AreEqual (1, dependentServices.Length, "#C2");
- Assert.AreEqual ("ClipSrv", dependentServices [0].ServiceName, "#C3");
+ Assert.AreEqual (SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON.Dependents, ServiceNames (dependentServices), "#C2");
servicesDependedOn = sc.ServicesDependedOn;
- Assert.IsNotNull (servicesDependedOn, "#C4");
- Assert.AreEqual (1, servicesDependedOn.Length, "#C5");
- Assert.AreEqual ("NetDDEDSDM", servicesDependedOn [0].ServiceName, "#C6");
+ Assert.IsNotNull (servicesDependedOn, "#C3");
+ Assert.AreEqual (SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#C4");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
sc.Refresh ();
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
+ var s1 = WORKSTATION_SERVICE;
+ var s2 = WINDOWS_SEARCH_SERVICE;
+
ServiceController sc = new ServiceController ();
- sc.ServiceName = "lanmanworkstation";
- Assert.AreEqual ("Workstation", sc.DisplayName, "#A1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
+ sc.ServiceName = s1.ServiceName;
+ Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#A1");
+ Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#A2");
- sc.ServiceName = "alerter";
- Assert.AreEqual ("Alerter", sc.DisplayName, "#B1");
- Assert.AreEqual ("alerter", sc.ServiceName, "#B2");
+ sc.ServiceName = s2.ServiceName;
+ Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#B1");
+ Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#B2");
- sc = new ServiceController ("lanmanworkstation");
- sc.ServiceName = "alerter";
- Assert.AreEqual ("alerter", sc.ServiceName, "#C1");
- Assert.AreEqual ("Alerter", sc.DisplayName, "#C2");
- Assert.AreEqual ("Alerter", sc.DisplayName, "#C3");
+ sc = new ServiceController (s1.ServiceName);
+ sc.ServiceName = s2.ServiceName;
+ Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#C1");
+ Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#C2");
+ Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#C3");
- sc.ServiceName = "alerter";
- Assert.AreEqual ("alerter", sc.ServiceName, "#D1");
- Assert.AreEqual ("Alerter", sc.DisplayName, "#D2");
+ sc.ServiceName = s2.ServiceName;
+ Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#D1");
+ Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#D2");
- sc.ServiceName = "lanmanworkstation";
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#E1");
- Assert.AreEqual ("Workstation", sc.DisplayName, "#E2");
+ sc.ServiceName = s1.ServiceName;
+ Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#E1");
+ Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#E2");
- sc = new ServiceController ("lanmanWorkstation");
- Assert.AreEqual ("lanmanWorkstation", sc.ServiceName, "#F1");
- Assert.AreEqual ("Workstation", sc.DisplayName, "#F2");
+ sc = new ServiceController (s1.ServiceName.ToUpper ());
+ Assert.AreEqual (s1.ServiceName.ToUpper (), sc.ServiceName, "#F1");
+ Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#F2");
- sc.ServiceName = "LanManWorkstation";
- Assert.AreEqual ("LanManWorkstation", sc.ServiceName, "#G1");
- Assert.AreEqual ("Workstation", sc.DisplayName, "#G2");
+ var serviceName = s1.ServiceName [0].ToString ().ToUpper () + s1.ServiceName.Substring (1).ToLower ();
+ sc.ServiceName = serviceName;
+ Assert.AreEqual (serviceName, sc.ServiceName, "#G1");
+ Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#G2");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("dmserver",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
string serviceName = sc.ServiceName;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("NetDDE", ".");
- Assert.AreEqual ("NetDDE", sc.ServiceName);
+ ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+ Assert.AreEqual (DISABLED_SERVICE.ServiceName, sc.ServiceName);
}
[Test]
Assert.Ignore ("Running on Unix.");
ServiceController sc = new ServiceController ();
- sc.ServiceName = "lanmanworkstation";
- Assert.AreEqual ("Workstation", sc.DisplayName, "#1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#2");
+ sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#1");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#2");
}
[Test]
Assert.AreEqual (string.Empty, sc.DisplayName, "#A1");
Assert.AreEqual (string.Empty, sc.ServiceName, "#A2");
- sc.ServiceName = "lanmanworkstation";
+ sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
- Assert.AreEqual ("Workstation", sc.DisplayName, "#B1");
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#B2");
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#B1");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#B2");
try {
sc.ServiceName = string.Empty;
Assert.Ignore ("Running on Unix.");
ServiceController sc = new ServiceController ();
- sc.ServiceName = "lanmanworkstation";
+ sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
try {
sc.ServiceName = null;
Assert.Fail ("#1");
Assert.IsNull (ex.InnerException, "#6");
}
- Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#7");
+ Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#7");
}
[Test]
Assert.Ignore ("Running on Unix.");
ServiceController sc = new ServiceController ();
- sc.ServiceName = "workstation";
+ sc.ServiceName = WORKSTATION_SERVICE.DisplayName.ToLower ();
try {
string displayName = sc.DisplayName;
Assert.Fail ("#1: " + displayName);
} catch (InvalidOperationException ex) {
- // Display name could not be retrieved for service workstation
+ // Display name could not be retrieved for service XXX
// on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
Assert.IsNotNull (ex.Message, "#3");
- Assert.IsTrue (ex.Message.IndexOf ("workstation") != -1, "#4");
+ Assert.IsTrue (ex.Message.IndexOf (WORKSTATION_SERVICE.DisplayName.ToLower ()) != -1, "#4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#5");
Assert.IsNotNull (ex.InnerException, "#6");
Assert.AreEqual (1060, win32Error.NativeErrorCode, "#10");
Assert.IsNull (win32Error.InnerException, "#11");
}
- Assert.AreEqual ("workstation", sc.ServiceName, "#12");
+ Assert.AreEqual (WORKSTATION_SERVICE.DisplayName.ToLower (), sc.ServiceName, "#12");
}
[Test]
ServiceController [] servicesDependedOn = null;
// single depended service
- sc = new ServiceController ("spooler", ".");
+ sc = new ServiceController (SERVICE_WITH_ONE_DEPENDED_ON.ServiceName, ".");
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#A1");
Assert.AreEqual (1, servicesDependedOn.Length, "#A2");
- Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#A3");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#A3");
// modifying ServiceName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.ServiceName = "lanmanworkstation";
+ sc.ServiceName = SERVICE_WITH_NO_DEPENDED_ON.ServiceName;
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#B1");
Assert.AreEqual (1, servicesDependedOn.Length, "#B2");
- Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#B3");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#B3");
// modifying DisplayName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.DisplayName = "alerter";
+ sc.DisplayName = SERVICE_WITH_MANY_DEPENDED_ON.DisplayName;
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#C1");
Assert.AreEqual (1, servicesDependedOn.Length, "#C2");
- Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#C3");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#C3");
// modifying MachineName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#D1");
Assert.AreEqual (1, servicesDependedOn.Length, "#D2");
- Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#D3");
+ Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#D3");
// no depended services
- sc = new ServiceController ("lanmanworkstation", ".");
+ sc = new ServiceController (SERVICE_WITH_NO_DEPENDED_ON.ServiceName, ".");
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#E1");
Assert.AreEqual (0, servicesDependedOn.Length, "#E2");
// modifying ServiceName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.ServiceName = "spooler";
+ sc.ServiceName = SERVICE_WITH_MANY_DEPENDED_ON.ServiceName;
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#F1");
Assert.AreEqual (0, servicesDependedOn.Length, "#F2");
// modifying DisplayName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.DisplayName = "Alerter";
+ sc.DisplayName = SERVICE_WITH_ONE_DEPENDED_ON.DisplayName;
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#G1");
Assert.AreEqual (0, servicesDependedOn.Length, "#G2");
Assert.AreEqual (0, servicesDependedOn.Length, "#H2");
// multiple depended services
- sc = new ServiceController ("dmadmin", ".");
+ sc = new ServiceController (SERVICE_WITH_MANY_DEPENDED_ON.ServiceName, ".");
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#I1");
- Assert.AreEqual (3, servicesDependedOn.Length, "#I2");
- // do not rely on the order of the services
- Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#I3");
- Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#I4");
- Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#I5");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#I2");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#I3");
// modifying ServiceName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.ServiceName = "spooler";
+ sc.ServiceName = SERVICE_WITH_NO_DEPENDED_ON.ServiceName;
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#J1");
- Assert.AreEqual (3, servicesDependedOn.Length, "#J2");
- // do not rely on the order of the services
- Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#J3");
- Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#J4");
- Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#J5");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#J2");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#J3");
// modifying DisplayName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
- sc.DisplayName = "Alerter";
+ sc.DisplayName = SERVICE_WITH_ONE_DEPENDED_ON.DisplayName;
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#K1");
- Assert.AreEqual (3, servicesDependedOn.Length, "#K2");
- // do not rely on the order of the services
- Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#K3");
- Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#K4");
- Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#K5");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#K2");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#K3");
// modifying MachineName does not cause cache to be cleared:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
sc.MachineName = Environment.MachineName;
servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#L1");
- Assert.AreEqual (3, servicesDependedOn.Length, "#L2");
- // do not rely on the order of the services
- Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#L3");
- Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#L4");
- Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#L5");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#L2");
+ Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#L3");
}
[Test]
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("dmserver",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("ClipSrv", ".");
+ ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
Assert.IsNotNull (servicesDependedOn, "#1");
- Assert.AreEqual (1, servicesDependedOn.Length, "#2");
- Assert.AreEqual ("NetDDE", servicesDependedOn [0].ServiceName, "#3");
+ Assert.AreEqual (DISABLED_SERVICE.DependedOn, ServiceNames (servicesDependedOn), "#2");
}
[Test]
ServiceController sc = null;
- sc = new ServiceController ("dmserver", ".");
+ sc = new ServiceController (SHARE_PROCESS_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#A1");
- sc.ServiceName = "Disk";
+ sc.ServiceName = KERNEL_SERVICE.ServiceName;
Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#A2");
- sc.DisplayName = "Workstation";
+ sc.DisplayName = SHARE_PROCESS_SERVICE.ServiceName;
Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#A3");
sc.MachineName = "doesnotexist";
try {
Assert.IsNull (win32Error.InnerException, "#A13");
}
- sc = new ServiceController ("Disk", ".");
+ sc = new ServiceController (KERNEL_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#B1");
- sc.DisplayName = "Alerter";
+ sc.DisplayName = SHARE_PROCESS_SERVICE.DisplayName;
Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#B2");
sc.MachineName = Environment.MachineName;
Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#B3");
- sc.ServiceName = "Disk";
+ sc.ServiceName = KERNEL_SERVICE.ServiceName;
Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#B4");
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("dmserver",
+ ServiceController sc = new ServiceController (SHARE_PROCESS_SERVICE.ServiceName,
"doesnotexist");
try {
ServiceType serviceType = sc.ServiceType;
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("NetDDE", ".");
+ ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType);
}
ServiceController sc = null;
sc = new ServiceController ();
- sc.DisplayName = "workstation";
+ sc.DisplayName = SHARE_PROCESS_SERVICE.DisplayName.ToLower ();
Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#1");
sc = new ServiceController ();
- sc.DisplayName = "disk driver";
+ sc.DisplayName = KERNEL_SERVICE.DisplayName.ToLower ();
Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#2");
}
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
sc.Stop ();
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("NetDDE", ".");
- ServiceController sc2 = new ServiceController ("NetDDE", ".");
+ ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
// Cannot stop NetDDE service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("NetDDE") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (DISABLED_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("SamSs", ".");
- ServiceController sc2 = new ServiceController ("SamSs", ".");
+ ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
sc1.Stop ();
Assert.Fail ("#B1");
} catch (InvalidOperationException ex) {
- // Cannot stop SamSs service on computer '.'
+ // Cannot stop XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
- Assert.IsTrue (ex.Message.IndexOf ("SamSs") != -1, "#B4");
+ Assert.IsTrue (ex.Message.IndexOf (UNCONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
Assert.IsNotNull (ex.InnerException, "#B6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
sc1.Stop ();
Assert.Fail ("#D1");
} catch (InvalidOperationException ex) {
- // Cannot stop Schedule service on computer '.'
+ // Cannot stop XXX service on computer '.'
Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
Assert.IsNotNull (ex.Message, "#D3");
- Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+ Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
Assert.IsNotNull (ex.InnerException, "#D6");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc = new ServiceController ("Schedule",
+ ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
"doesnotexist");
try {
sc.WaitForStatus (ServiceControllerStatus.Stopped,
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("NetDDE", ".");
- ServiceController sc2 = new ServiceController ("NetDDE", ".");
+ ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("SamSs", ".");
- ServiceController sc2 = new ServiceController ("SamSs", ".");
+ ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
if (RunningOnUnix)
Assert.Ignore ("Running on Unix.");
- ServiceController sc1 = new ServiceController ("Schedule", ".");
- ServiceController sc2 = new ServiceController ("Schedule", ".");
+ ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+ ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#C2");
}
+ // Run this on .NET to generate ServiceInfo objects for services on the current machine
+// [Test]
+ public static void DumpServices ()
+ {
+ foreach (ServiceController sc in ServiceController.GetServices ()) {
+ try {
+ var si = new ServiceInfo { ServiceName = sc.ServiceName, DisplayName = sc.DisplayName, ServiceType = sc.ServiceType, Dependents = ServiceNames (sc.DependentServices), DependedOn = ServiceNames (sc.ServicesDependedOn) };
+ var l = new List<string> ();
+ l.Add ($"ServiceName = \"{si.ServiceName}\"");
+ l.Add ($"DisplayName = \"{si.DisplayName}\"");
+ if (si.ServiceType != ServiceType.Win32ShareProcess)
+ l.Add ($"ServiceType = ServiceType.{si.ServiceType}");
+ if (si.Dependents.Length > 0)
+ l.Add ("Dependents = new [] { \"" + String.Join ("\", \"", si.Dependents) + "\" }");
+ if (si.DependedOn.Length > 0)
+ l.Add ("DependedOn = new [] { \"" + String.Join ("\", \"", si.DependedOn) + "\" }");
+ Console.WriteLine ("static ServiceInfo " + si.DisplayName.ToUpper ().Replace (' ', '_').Replace ('-', '_') + "_SERVICE = new ServiceInfo { " + String.Join (", ", l) + " };");
+ } catch {
+ }
+ }
+ }
+
private static void EnsureServiceIsRunning (ServiceController sc)
{
sc.Refresh ();
return false;
}
+ private static string[] ServiceNames (ServiceController [] services)
+ {
+ var result = new string [services.Length];
+ for (var i = 0; i < result.Length; i++)
+ result [i] = services [i].ServiceName.ToLower ();
+ Array.Sort<string> (result);
+ return result;
+ }
+
private bool RunningOnUnix
{
get {
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
if (IsServer) {
SetPrivateCertificate (nativeServerCertificate);
} else {
- ssl.SetServerName (TargetHost);
+ ssl.SetServerName (ServerName);
}
}
if (!IsServer)
ctx.SetSelectCallback (SelectCallback);
- var host = TargetHost;
- if (!string.IsNullOrEmpty (host)) {
- var pos = TargetHost.IndexOf (':');
- if (pos > 0)
- host = host.Substring (0, pos);
- }
-
- ctx.SetVerifyParam (MonoBtlsProvider.GetVerifyParam (host, IsServer));
+ ctx.SetVerifyParam (MonoBtlsProvider.GetVerifyParam (ServerName, IsServer));
TlsProtocolCode minProtocol, maxProtocol;
GetProtocolVersions (out minProtocol, out maxProtocol);
MobileAuthenticatedStream parent;
bool serverMode;
string targetHost;
+ string serverName;
SslProtocols enabledProtocols;
X509Certificate serverCertificate;
X509CertificateCollection clientCertificates;
this.clientCertificates = clientCertificates;
this.askForClientCert = askForClientCert;
+ serverName = targetHost;
+ if (!string.IsNullOrEmpty (serverName)) {
+ var pos = serverName.IndexOf (':');
+ if (pos > 0)
+ serverName = serverName.Substring (0, pos);
+ }
+
certificateValidator = CertificateValidationHelper.GetInternalValidator (
parent.Settings, parent.Provider);
}
get { return targetHost; }
}
+ protected string ServerName {
+ get { return serverName; }
+ }
+
protected bool AskForClientCertificate {
get { return askForClientCert; }
}
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
get {
Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
// FIXME: should ipv6 DhcpServer be considered?
- return ai != null ? Win32FromUnicast ((int) ai.Index, addr.FirstUnicastAddress) : new UnicastIPAddressInformationCollection ();
+ return ai != null ? Win32FromUnicast (addr.FirstUnicastAddress) : new UnicastIPAddressInformationCollection ();
}
}
- static UnicastIPAddressInformationCollection Win32FromUnicast (int ifIndex, IntPtr ptr)
+ static UnicastIPAddressInformationCollection Win32FromUnicast (IntPtr ptr)
{
UnicastIPAddressInformationCollection c = new UnicastIPAddressInformationCollection ();
Win32_IP_ADAPTER_UNICAST_ADDRESS a;
for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADAPTER_UNICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_UNICAST_ADDRESS));
- c.InternalAdd (new Win32UnicastIPAddressInformation (ifIndex, a));
+ c.InternalAdd (new Win32UnicastIPAddressInformation (a));
}
return c;
}
using System;
using System.Runtime.InteropServices;
using System.Net.Sockets;
+using System.Diagnostics.Contracts;
namespace System.Net.NetworkInformation {
#if !MOBILE
class Win32UnicastIPAddressInformation : UnicastIPAddressInformation
{
- int if_index;
Win32_IP_ADAPTER_UNICAST_ADDRESS info;
+ IPAddress ipv4Mask;
- public Win32UnicastIPAddressInformation (int ifIndex, Win32_IP_ADAPTER_UNICAST_ADDRESS info)
+ public Win32UnicastIPAddressInformation (Win32_IP_ADAPTER_UNICAST_ADDRESS info)
{
- this.if_index = ifIndex;
this.info = info;
+ IPAddress ipAddress = info.Address.GetIPAddress ();
+ // IPv6 returns 0.0.0.0 for consistancy with XP
+ if (ipAddress.AddressFamily == AddressFamily.InterNetwork) {
+ ipv4Mask = PrefixLengthToSubnetMask (info.OnLinkPrefixLength, ipAddress.AddressFamily);
+ }
}
public override IPAddress Address {
get { return info.DadState; }
}
- public override IPAddress IPv4Mask {
+ public override IPAddress IPv4Mask{
get {
- Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (if_index);
- if (ai == null)
- throw new Exception ("huh? " + if_index);
- if (this.Address == null)
- return null;
- string expected = this.Address.ToString ();
- unsafe {
- Win32_IP_ADDR_STRING p = ai.IpAddressList;
- while (true) {
- if (p.IpAddress == expected)
- return IPAddress.Parse (p.IpMask);
- if (p.Next == IntPtr.Zero)
- break;
- p = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p.Next, typeof (Win32_IP_ADDR_STRING));
- }
-
- // Or whatever it should be...
- return null;
+ // The IPv6 equivilant was never available on XP, and we've kept this behavior for legacy reasons.
+ // For IPv6 use PrefixLength instead.
+ if (Address.AddressFamily != AddressFamily.InterNetwork) {
+ return IPAddress.Any;
}
+
+ return ipv4Mask;
}
}
public override SuffixOrigin SuffixOrigin {
get { return info.SuffixOrigin; }
}
+
+ // Convert a CIDR prefix length to a subnet mask "255.255.255.0" format
+ private static IPAddress PrefixLengthToSubnetMask (byte prefixLength, AddressFamily family) {
+ Contract.Requires ((0 <= prefixLength) && (prefixLength <= 126));
+ Contract.Requires ((family == AddressFamily.InterNetwork) || (family == AddressFamily.InterNetworkV6));
+
+ byte[] addressBytes;
+ if (family == AddressFamily.InterNetwork) {
+ addressBytes = new byte [4];
+ } else { // v6
+ addressBytes = new byte [16];
+ }
+
+ Contract.Assert (prefixLength < (addressBytes.Length * 8));
+
+ // Enable bits one at a time from left/high to right/low
+ for (int bit = 0; bit < prefixLength; bit++) {
+ addressBytes [bit / 8] |= (byte) (0x80 >> (bit % 8));
+ }
+
+ return new IPAddress (addressBytes);
+ }
}
#endif
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
[SecurityPermission (SecurityAction.Assert, SerializationFormatter = true)] // FIXME: to be reviewed
internal static byte[] SerializeExceptionData (Exception ex)
{
+ byte[] result = null;
try {
- int retry = 4;
-
- do {
- try {
- MemoryStream ms = new MemoryStream ();
- _serializationFormatter.Serialize (ms, ex);
- return ms.ToArray ();
- }
- catch (Exception e) {
- if (e is ThreadAbortException) {
-#if MONO_FEATURE_THREAD_ABORT
- Thread.ResetAbort ();
-#endif
- retry = 5;
- ex = e;
- }
- else if (retry == 2) {
- ex = new Exception ();
- ex.SetMessage (e.Message);
- ex.SetStackTrace (e.StackTrace);
- }
- else
- ex = e;
- }
- retry--;
- }
- while (retry > 0);
-
- return null;
- }
- catch (Exception tex)
- {
- byte[] data = SerializeExceptionData (tex);
-#if MONO_FEATURE_THREAD_ABORT
- Thread.ResetAbort ();
-#endif
- return data;
+ /* empty - we're only interested in the protected block */
+ } finally {
+ MemoryStream ms = new MemoryStream ();
+ _serializationFormatter.Serialize (ms, ex);
+ result = ms.ToArray ();
}
+ return result;
}
internal static object GetDomainProxy(AppDomain domain)
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
//
// A candidate with no default parameters is still better when there
- // is no better expression conversion
+ // is no better expression conversion and does not have more parameters
//
if (candidate_pd.Count < best_pd.Count) {
- if (!candidate_params && !candidate_pd.FixedParameters [j - 1].HasDefaultValue) {
+ if (candidate_params)
+ return false;
+
+ if (!candidate_pd.FixedParameters [j - 1].HasDefaultValue)
return true;
- }
+
+ if (best_pd.FixedParameters [j].HasDefaultValue)
+ return true;
+
} else if (candidate_pd.Count == best_pd.Count) {
if (candidate_params)
return false;
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
[STAThread]\r
public static int Main(string[] args)\r
{\r
+ Console.ForegroundColor = ConsoleColor.Red;\r
+ Console.WriteLine ("Note: nunit-console shipped with Mono is deprecated, please use the NUnit NuGet package or some other form of acquiring NUnit.");\r
+ Console.ResetColor ();\r
return Runner.Main( args );\r
}\r
}\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
/// {}\r
/// </example>\r
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]\r
+ [Obsolete ("The NUnit framework shipped with Mono is deprecated and will be removed in a future release. It was based on NUnit 2.4 which is long outdated. Please move to the NUnit NuGet package or some other form of acquiring NUnit.", true)]\r
public class TestFixtureAttribute : Attribute\r
{\r
private string description;\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
--- /dev/null
+using System;
+
+internal class Program
+{
+ public static void Main ()
+ {
+ AttributeOrDefault ("firstItem", null);
+ }
+
+ public static string AttributeOrDefault (string attribute, string defaultValue = null)
+ {
+ return "";
+ }
+
+ public static string AttributeOrDefault (string attribute, bool? klass, string defaultValue = null)
+ {
+ throw new ApplicationException ();
+ }
+}
</method>
</type>
</test>
+ <test name="gtest-optional-40.cs">
+ <type name="Program">
+ <method name="Void Main()" attrs="150">
+ <size>14</size>
+ </method>
+ <method name="System.String AttributeOrDefault(System.String, System.String)" attrs="150">
+ <size>14</size>
+ </method>
+ <method name="System.String AttributeOrDefault(System.String, System.Nullable`1[System.Boolean], System.String)" attrs="150">
+ <size>7</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-partial-01.cs">
<type name="B`1[U]">
<method name="Void .ctor()" attrs="6278">
net_4_5_dirs := \
al \
linker \
- tuner \
culevel \
genxs \
mkbundle \
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+++ /dev/null
-Jb Evain <jbevain@novell.com>
+++ /dev/null
-Copyright (c) 2007 Novell, Inc and the individuals listed on the
-ChangeLog entries.
-
-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.
+++ /dev/null
-//
-// BaseStep.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public abstract class BaseStep : IStep {
-
- private LinkContext _context;
-
- public LinkContext Context {
- get { return _context; }
- }
-
- public AnnotationStore Annotations {
- get { return _context.Annotations; }
- }
-
- public void Process (LinkContext context)
- {
- _context = context;
-
- if (!ConditionToProcess ())
- return;
-
- Process ();
-
- foreach (AssemblyDefinition assembly in context.GetAssemblies ())
- ProcessAssembly (assembly);
-
- EndProcess ();
- }
-
- protected virtual bool ConditionToProcess ()
- {
- return true;
- }
-
- protected virtual void Process ()
- {
- }
-
- protected virtual void EndProcess ()
- {
- }
-
- protected virtual void ProcessAssembly (AssemblyDefinition assembly)
- {
- }
- }
-}
+++ /dev/null
-//
-// Blacklist.cs
-//
-// Author:
-// Jb Evain (jb@nurv.fr)
-//
-// (C) 2007 Novell Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Linq;
-using System.IO;
-using System.Reflection;
-using System.Xml;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class BlacklistStep : BaseStep {
-
- protected override bool ConditionToProcess()
- {
- return Context.CoreAction == AssemblyAction.Link;
- }
-
- protected override void Process ()
- {
- foreach (string name in Assembly.GetExecutingAssembly ().GetManifestResourceNames ()) {
- if (!name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase) || !IsReferenced (GetAssemblyName (name)))
- continue;
-
- try {
- if (Context.LogInternalExceptions)
- Console.WriteLine ("Processing resource linker descriptor: {0}", name);
- Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetResolveStep (name));
- } catch (XmlException ex) {
- /* This could happen if some broken XML file is included. */
- if (Context.LogInternalExceptions)
- Console.WriteLine ("Error processing {0}: {1}", name, ex);
- }
- }
-
- foreach (var asm in Context.GetAssemblies ()) {
- foreach (var rsc in asm.Modules
- .SelectMany (mod => mod.Resources)
- .Where (res => res.ResourceType == ResourceType.Embedded)
- .Where (res => res.Name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase))
- .Where (res => IsReferenced (GetAssemblyName (res.Name)))
- .Cast<EmbeddedResource> ()) {
- try {
- if (Context.LogInternalExceptions)
- Console.WriteLine ("Processing embedded resource linker descriptor: {0}", rsc.Name);
-
- Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetExternalResolveStep (rsc, asm));
- } catch (XmlException ex) {
- /* This could happen if some broken XML file is embedded. */
- if (Context.LogInternalExceptions)
- Console.WriteLine ("Error processing {0}: {1}", rsc.Name, ex);
- }
- }
- }
- }
-
- static string GetAssemblyName (string descriptor)
- {
- int pos = descriptor.LastIndexOf ('.');
- if (pos == -1)
- return descriptor;
-
- return descriptor.Substring (0, pos);
- }
-
- bool IsReferenced (string name)
- {
- foreach (AssemblyDefinition assembly in Context.GetAssemblies ())
- if (assembly.Name.Name == name)
- return true;
-
- return false;
- }
-
- static ResolveFromXmlStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly)
- {
- return new ResolveFromXmlStep (GetExternalDescriptor (resource), "resource " + resource.Name + " in " + assembly.FullName);
- }
-
- static ResolveFromXmlStep GetResolveStep (string descriptor)
- {
- return new ResolveFromXmlStep (GetDescriptor (descriptor), "descriptor " + descriptor + " from " + Assembly.GetExecutingAssembly ().FullName);
- }
-
- static XPathDocument GetExternalDescriptor (EmbeddedResource resource)
- {
- using (var sr = new StreamReader (resource.GetResourceStream ())) {
- return new XPathDocument (new StringReader (sr.ReadToEnd ()));
- }
- }
-
- static XPathDocument GetDescriptor (string descriptor)
- {
- using (StreamReader sr = new StreamReader (GetResource (descriptor))) {
- return new XPathDocument (new StringReader (sr.ReadToEnd ()));
- }
- }
-
- static Stream GetResource (string descriptor)
- {
- return Assembly.GetExecutingAssembly ().GetManifestResourceStream (descriptor);
- }
- }
-}
+++ /dev/null
-//
-// CleanStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class CleanStep : BaseStep {
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) == AssemblyAction.Link)
- CleanAssembly (assembly);
- }
-
- static void CleanAssembly (AssemblyDefinition asm)
- {
- foreach (TypeDefinition type in asm.MainModule.Types)
- CleanType (type);
- }
-
- static void CleanType (TypeDefinition type)
- {
- if (type.HasProperties)
- CleanProperties (type);
- if (type.HasEvents)
- CleanEvents (type);
-
- if (type.HasNestedTypes)
- foreach (var nested in type.NestedTypes)
- CleanType (nested);
- }
-
- static MethodDefinition CheckMethod (TypeDefinition type, MethodDefinition method)
- {
- if (method == null)
- return null;
-
- return type.Methods.Contains (method) ? method : null;
- }
-
- static void CleanEvents (TypeDefinition type)
- {
- var events = type.Events;
-
- for (int i = 0; i < events.Count; i++) {
- var evt = events [i];
- evt.AddMethod = CheckMethod (type, evt.AddMethod);
- evt.InvokeMethod = CheckMethod (type, evt.InvokeMethod);
- evt.RemoveMethod = CheckMethod (type, evt.RemoveMethod);
-
- if (!IsEventUsed (evt))
- events.RemoveAt (i--);
- }
- }
-
- static bool IsEventUsed (EventDefinition evt)
- {
- return evt.AddMethod != null || evt.InvokeMethod != null || evt.RemoveMethod != null;
- }
-
- static void CleanProperties (TypeDefinition type)
- {
- var properties = type.Properties;
-
- for (int i = 0; i < properties.Count; i++) {
- var prop = properties [i];
- prop.GetMethod = CheckMethod (type, prop.GetMethod);
- prop.SetMethod = CheckMethod (type, prop.SetMethod);
-
- if (!IsPropertyUsed (prop))
- properties.RemoveAt (i--);
- }
- }
-
- static bool IsPropertyUsed (PropertyDefinition prop)
- {
- return prop.GetMethod != null || prop.SetMethod != null;
- }
- }
-}
+++ /dev/null
-//
-// IStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Linker.Steps {
-
- public interface IStep {
- void Process (LinkContext context);
- }
-}
+++ /dev/null
-//
-// LoadI18nAssemblies.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class LoadI18nAssemblies : BaseStep {
-
- static readonly byte [] _pktoken = new byte [] {0x07, 0x38, 0xeb, 0x9f, 0x13, 0x2e, 0xd7, 0x56};
-
- I18nAssemblies _assemblies;
-
- public LoadI18nAssemblies (I18nAssemblies assemblies)
- {
- _assemblies = assemblies;
- }
-
- protected override bool ConditionToProcess ()
- {
- return _assemblies != I18nAssemblies.None &&
- Type.GetType ("System.MonoType") != null;
- }
-
- protected override void Process()
- {
- LoadAssembly (GetAssemblyName (I18nAssemblies.Base));
-
- LoadI18nAssembly (I18nAssemblies.CJK);
- LoadI18nAssembly (I18nAssemblies.MidEast);
- LoadI18nAssembly (I18nAssemblies.Other);
- LoadI18nAssembly (I18nAssemblies.Rare);
- LoadI18nAssembly (I18nAssemblies.West);
- }
-
- bool ShouldCopyAssembly (I18nAssemblies current)
- {
- return (current & _assemblies) != 0;
- }
-
- void LoadI18nAssembly (I18nAssemblies asm)
- {
- if (!ShouldCopyAssembly (asm))
- return;
-
- AssemblyNameReference name = GetAssemblyName (asm);
- LoadAssembly (name);
- }
-
- void LoadAssembly (AssemblyNameReference name)
- {
- AssemblyDefinition assembly = Context.Resolve (name);
- ResolveFromAssemblyStep.ProcessLibrary (Context, assembly);
- }
-
- AssemblyNameReference GetAssemblyName (I18nAssemblies assembly)
- {
- AssemblyNameReference name = new AssemblyNameReference ("I18N", GetCorlibVersion ());
- if (assembly != I18nAssemblies.Base)
- name.Name += "." + assembly;
-
- name.PublicKeyToken = _pktoken;
- return name;
- }
-
- Version GetCorlibVersion ()
- {
- foreach (AssemblyDefinition assembly in Context.GetAssemblies ())
- if (assembly.Name.Name == "mscorlib")
- return assembly.Name.Version;
-
- return new Version ();
- }
- }
-}
+++ /dev/null
-//
-// LoadReferencesStep.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class LoadReferencesStep : BaseStep {
-
- IDictionary _references = new Hashtable ();
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- ProcessReferences (assembly);
- }
-
- void ProcessReferences (AssemblyDefinition assembly)
- {
- if (_references.Contains (assembly.Name))
- return;
-
- _references.Add (assembly.Name, assembly);
-
- foreach (AssemblyNameReference reference in assembly.MainModule.AssemblyReferences)
- ProcessReferences (Context.Resolve (reference));
- }
- }
-}
+++ /dev/null
-//
-// MarkStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Linq;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker.Steps {
-
- public class MarkStep : IStep {
-
- protected LinkContext _context;
- protected Queue _methods;
- protected ArrayList _virtual_methods;
-
- public AnnotationStore Annotations {
- get { return _context.Annotations; }
- }
-
- public MarkStep ()
- {
- _methods = new Queue ();
- _virtual_methods = new ArrayList ();
- }
-
- public virtual void Process (LinkContext context)
- {
- _context = context;
-
- Initialize ();
- Process ();
- }
-
- void Initialize ()
- {
- foreach (AssemblyDefinition assembly in _context.GetAssemblies ())
- InitializeAssembly (assembly);
- }
-
- protected virtual void InitializeAssembly (AssemblyDefinition assembly)
- {
- MarkAssembly (assembly);
-
- foreach (TypeDefinition type in assembly.MainModule.Types)
- InitializeType (type);
- }
-
- void InitializeType (TypeDefinition type)
- {
- if (type.HasNestedTypes) {
- foreach (var nested in type.NestedTypes)
- InitializeType (nested);
- }
-
- if (!Annotations.IsMarked (type))
- return;
-
- MarkType (type);
-
- if (type.HasFields)
- InitializeFields (type);
- if (type.HasMethods)
- InitializeMethods (type.Methods);
- }
-
- void InitializeFields (TypeDefinition type)
- {
- foreach (FieldDefinition field in type.Fields)
- if (Annotations.IsMarked (field))
- MarkField (field);
- }
-
- void InitializeMethods (ICollection methods)
- {
- foreach (MethodDefinition method in methods)
- if (Annotations.IsMarked (method))
- EnqueueMethod (method);
- }
-
- void Process ()
- {
- if (QueueIsEmpty ())
- throw new InvalidOperationException ("No entry methods");
-
- while (!QueueIsEmpty ()) {
- ProcessQueue ();
- ProcessVirtualMethods ();
- }
- }
-
- void ProcessQueue ()
- {
- while (!QueueIsEmpty ()) {
- MethodDefinition method = (MethodDefinition) _methods.Dequeue ();
- Annotations.Push (method);
- ProcessMethod (method);
- Annotations.Pop ();
- }
- }
-
- bool QueueIsEmpty ()
- {
- return _methods.Count == 0;
- }
-
- protected virtual void EnqueueMethod (MethodDefinition method)
- {
- _methods.Enqueue (method);
- }
-
- void ProcessVirtualMethods ()
- {
- foreach (MethodDefinition method in _virtual_methods) {
- Annotations.Push (method);
- ProcessVirtualMethod (method);
- Annotations.Pop ();
- }
- }
-
- void ProcessVirtualMethod (MethodDefinition method)
- {
- IList overrides = Annotations.GetOverrides (method);
- if (overrides == null)
- return;
-
- foreach (MethodDefinition @override in overrides)
- ProcessOverride (@override);
- }
-
- void ProcessOverride (MethodDefinition method)
- {
- if (!Annotations.IsMarked (method.DeclaringType))
- return;
-
- if (Annotations.IsProcessed (method))
- return;
-
- if (Annotations.IsMarked (method))
- return;
-
- MarkMethod (method);
- ProcessVirtualMethod (method);
- }
-
- void MarkMarshalSpec (IMarshalInfoProvider spec)
- {
- if (!spec.HasMarshalInfo)
- return;
-
- var marshaler = spec.MarshalInfo as CustomMarshalInfo;
- if (marshaler == null)
- return;
-
- MarkType (marshaler.ManagedType);
- }
-
- void MarkCustomAttributes (ICustomAttributeProvider provider)
- {
- if (!provider.HasCustomAttributes)
- return;
-
- foreach (CustomAttribute ca in provider.CustomAttributes)
- MarkCustomAttribute (ca);
- }
-
- protected virtual void MarkCustomAttribute (CustomAttribute ca)
- {
- Annotations.Push (ca);
- MarkMethod (ca.Constructor);
-
- MarkCustomAttributeArguments (ca);
-
- TypeReference constructor_type = ca.Constructor.DeclaringType;
- TypeDefinition type = constructor_type.Resolve ();
- if (type == null) {
- Annotations.Pop ();
- throw new ResolutionException (constructor_type);
- }
-
- MarkCustomAttributeProperties (ca, type);
- MarkCustomAttributeFields (ca, type);
- Annotations.Pop ();
- }
-
- protected void MarkSecurityDeclarations (ISecurityDeclarationProvider provider)
- {
- // most security declarations are removed (if linked) but user code might still have some
- // and if the attribtues references types then they need to be marked too
- if ((provider == null) || !provider.HasSecurityDeclarations)
- return;
-
- foreach (var sd in provider.SecurityDeclarations)
- MarkSecurityDeclaration (sd);
- }
-
- protected virtual void MarkSecurityDeclaration (SecurityDeclaration sd)
- {
- if (!sd.HasSecurityAttributes)
- return;
-
- foreach (var sa in sd.SecurityAttributes)
- MarkSecurityAttribute (sa);
- }
-
- protected virtual void MarkSecurityAttribute (SecurityAttribute sa)
- {
- TypeReference security_type = sa.AttributeType;
- TypeDefinition type = security_type.Resolve ();
- if (type == null)
- throw new ResolutionException (security_type);
-
- MarkType (security_type);
- MarkSecurityAttributeProperties (sa, type);
- MarkSecurityAttributeFields (sa, type);
- }
-
- protected void MarkSecurityAttributeProperties (SecurityAttribute sa, TypeDefinition attribute)
- {
- if (!sa.HasProperties)
- return;
-
- foreach (var named_argument in sa.Properties)
- MarkCustomAttributeProperty (named_argument, attribute);
- }
-
- protected void MarkSecurityAttributeFields (SecurityAttribute sa, TypeDefinition attribute)
- {
- if (!sa.HasFields)
- return;
-
- foreach (var named_argument in sa.Fields)
- MarkCustomAttributeField (named_argument, attribute);
- }
-
- protected void MarkCustomAttributeProperties (CustomAttribute ca, TypeDefinition attribute)
- {
- if (!ca.HasProperties)
- return;
-
- foreach (var named_argument in ca.Properties)
- MarkCustomAttributeProperty (named_argument, attribute);
- }
-
- protected void MarkCustomAttributeProperty (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
- {
- PropertyDefinition property = GetProperty (attribute, namedArgument.Name);
- Annotations.Push (property);
- if (property != null)
- MarkMethod (property.SetMethod);
-
- MarkIfType (namedArgument.Argument);
- Annotations.Pop ();
- }
-
- PropertyDefinition GetProperty (TypeDefinition type, string propertyname)
- {
- while (type != null) {
- PropertyDefinition property = type.Properties.FirstOrDefault (p => p.Name == propertyname);
- if (property != null)
- return property;
-
- type = type.BaseType != null ? ResolveTypeDefinition (type.BaseType) : null;
- }
-
- return null;
- }
-
- protected void MarkCustomAttributeFields (CustomAttribute ca, TypeDefinition attribute)
- {
- if (!ca.HasFields)
- return;
-
- foreach (var named_argument in ca.Fields)
- MarkCustomAttributeField (named_argument, attribute);
- }
-
- protected void MarkCustomAttributeField (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
- {
- FieldDefinition field = GetField (attribute, namedArgument.Name);
- if (field != null)
- MarkField (field);
-
- MarkIfType (namedArgument.Argument);
- }
-
- FieldDefinition GetField (TypeDefinition type, string fieldname)
- {
- while (type != null) {
- FieldDefinition field = type.Fields.FirstOrDefault (f => f.Name == fieldname);
- if (field != null)
- return field;
-
- type = type.BaseType != null ? ResolveTypeDefinition (type.BaseType) : null;
- }
-
- return null;
- }
-
- void MarkCustomAttributeArguments (CustomAttribute ca)
- {
- if (!ca.HasConstructorArguments)
- return;
-
- foreach (var argument in ca.ConstructorArguments)
- MarkIfType (argument);
- }
-
- void MarkIfType (CustomAttributeArgument argument)
- {
- var at = argument.Type;
- if (at.IsArray) {
- var et = at.GetElementType ();
- if (et.Namespace != "System" || et.Name != "Type")
- return;
-
- MarkType (et);
- if (argument.Value == null)
- return;
-
- foreach (var cac in (CustomAttributeArgument[]) argument.Value)
- MarkWithResolvedScope ((TypeReference) cac.Value);
- } else if (at.Namespace == "System" && at.Name == "Type") {
- MarkType (argument.Type);
- MarkWithResolvedScope ((TypeReference) argument.Value);
- }
- }
-
- // custom attributes encoding means it's possible to have a scope that will point into a PCL facade
- // even if we (just before saving) will resolve all type references (bug #26752)
- void MarkWithResolvedScope (TypeReference type)
- {
- if (type == null)
- return;
-
- // a GenericInstanceType can could contains generic arguments with scope that
- // needs to be updated out of the PCL facade (bug #28823)
- var git = (type as GenericInstanceType);
- if ((git != null) && git.HasGenericArguments) {
- foreach (var ga in git.GenericArguments)
- MarkWithResolvedScope (ga);
- }
- // we cannot set the Scope of a TypeSpecification but it's element type can be set
- // e.g. System.String[] -> System.String
- var ts = (type as TypeSpecification);
- if (ts != null) {
- MarkWithResolvedScope (ts.GetElementType ());
- return;
- }
-
- var td = type.Resolve ();
- if (td != null)
- type.Scope = td.Scope;
- MarkType (type);
- }
-
- protected bool CheckProcessed (IMetadataTokenProvider provider)
- {
- if (Annotations.IsProcessed (provider))
- return true;
-
- Annotations.Processed (provider);
- return false;
- }
-
- protected void MarkAssembly (AssemblyDefinition assembly)
- {
- if (CheckProcessed (assembly))
- return;
-
- ProcessModule (assembly);
-
- MarkCustomAttributes (assembly);
- MarkSecurityDeclarations (assembly);
-
- foreach (ModuleDefinition module in assembly.Modules)
- MarkCustomAttributes (module);
- }
-
- void ProcessModule (AssemblyDefinition assembly)
- {
- // Pre-mark <Module> if there is any methods as they need to be executed
- // at assembly load time
- foreach (TypeDefinition type in assembly.MainModule.Types)
- {
- if (type.Name == "<Module>" && type.HasMethods)
- {
- MarkType (type);
- break;
- }
- }
- }
-
- protected void MarkField (FieldReference reference)
- {
-// if (IgnoreScope (reference.DeclaringType.Scope))
-// return;
-
- if (reference.DeclaringType is GenericInstanceType)
- MarkType (reference.DeclaringType);
-
- FieldDefinition field = ResolveFieldDefinition (reference);
-
- if (field == null)
- throw new ResolutionException (reference);
-
- if (CheckProcessed (field))
- return;
-
- MarkType (field.DeclaringType);
- MarkType (field.FieldType);
- MarkCustomAttributes (field);
- MarkMarshalSpec (field);
-
- Annotations.Mark (field);
- }
-
- protected virtual bool IgnoreScope (IMetadataScope scope)
- {
- AssemblyDefinition assembly = ResolveAssembly (scope);
- return Annotations.GetAction (assembly) != AssemblyAction.Link;
- }
-
- FieldDefinition ResolveFieldDefinition (FieldReference field)
- {
- FieldDefinition fd = field as FieldDefinition;
- if (fd == null)
- fd = field.Resolve ();
-
- return fd;
- }
-
- void MarkScope (IMetadataScope scope)
- {
- var provider = scope as IMetadataTokenProvider;
- if (provider == null)
- return;
-
- Annotations.Mark (provider);
- }
-
- protected virtual void MarkSerializable (TypeDefinition type)
- {
- MarkDefaultConstructor (type);
- MarkMethodsIf (type.Methods, IsSpecialSerializationConstructorPredicate);
- }
-
- protected virtual TypeDefinition MarkType (TypeReference reference)
- {
- if (reference == null)
- return null;
-
- reference = GetOriginalType (reference);
-
- if (reference is GenericParameter)
- return null;
-
-// if (IgnoreScope (reference.Scope))
-// return;
-
- TypeDefinition type = ResolveTypeDefinition (reference);
-
- if (type == null)
- throw new ResolutionException (reference);
-
- if (CheckProcessed (type))
- return null;
-
- Annotations.Push (type);
-
- MarkScope (type.Scope);
- MarkType (type.BaseType);
- MarkType (type.DeclaringType);
- MarkCustomAttributes (type);
- MarkSecurityDeclarations (type);
-
- if (IsMulticastDelegate (type)) {
- MarkMethodCollection (type.Methods);
- }
-
- if (IsSerializable (type))
- MarkSerializable (type);
-
- MarkTypeSpecialCustomAttributes (type);
-
- MarkGenericParameterProvider (type);
-
- // keep fields for value-types and for classes with LayoutKind.Sequential or Explicit
- if (type.IsValueType || !type.IsAutoLayout)
- MarkFields (type, type.IsEnum);
-
- if (type.HasInterfaces) {
- foreach (var iface in type.Interfaces)
- MarkType (iface.InterfaceType);
- }
-
- if (type.HasMethods) {
- MarkMethodsIf (type.Methods, IsVirtualAndHasPreservedParent);
- MarkMethodsIf (type.Methods, IsStaticConstructorPredicate);
- MarkMethodsIf (type.Methods, HasSerializationAttribute);
- }
-
- DoAdditionalTypeProcessing (type);
-
- Annotations.Pop ();
-
- Annotations.Mark (type);
-
- ApplyPreserveInfo (type);
-
- return type;
- }
-
- // Allow subclassers to mark additional things when marking a method
- protected virtual void DoAdditionalTypeProcessing (TypeDefinition method)
- {
- }
-
- void MarkTypeSpecialCustomAttributes (TypeDefinition type)
- {
- if (!type.HasCustomAttributes)
- return;
-
- foreach (CustomAttribute attribute in type.CustomAttributes) {
- switch (attribute.Constructor.DeclaringType.FullName) {
- case "System.Xml.Serialization.XmlSchemaProviderAttribute":
- MarkXmlSchemaProvider (type, attribute);
- break;
- }
- }
- }
-
- void MarkMethodSpecialCustomAttributes (MethodDefinition method)
- {
- if (!method.HasCustomAttributes)
- return;
-
- foreach (CustomAttribute attribute in method.CustomAttributes) {
- switch (attribute.Constructor.DeclaringType.FullName) {
- case "System.Web.Services.Protocols.SoapHeaderAttribute":
- MarkSoapHeader (method, attribute);
- break;
- }
- }
- }
-
- void MarkXmlSchemaProvider (TypeDefinition type, CustomAttribute attribute)
- {
- string method_name;
- if (!TryGetStringArgument (attribute, out method_name))
- return;
-
- MarkNamedMethod (type, method_name);
- }
-
- static bool TryGetStringArgument (CustomAttribute attribute, out string argument)
- {
- argument = null;
-
- if (attribute.ConstructorArguments.Count < 1)
- return false;
-
- argument = attribute.ConstructorArguments [0].Value as string;
-
- return argument != null;
- }
-
- protected int MarkNamedMethod (TypeDefinition type, string method_name)
- {
- if (!type.HasMethods)
- return 0;
-
- int count = 0;
- foreach (MethodDefinition method in type.Methods) {
- if (method.Name != method_name)
- continue;
-
- MarkMethod (method);
- count++;
- }
-
- return count;
- }
-
- void MarkSoapHeader (MethodDefinition method, CustomAttribute attribute)
- {
- string member_name;
- if (!TryGetStringArgument (attribute, out member_name))
- return;
-
- MarkNamedField (method.DeclaringType, member_name);
- MarkNamedProperty (method.DeclaringType, member_name);
- }
-
- void MarkNamedField (TypeDefinition type, string field_name)
- {
- if (!type.HasFields)
- return;
-
- foreach (FieldDefinition field in type.Fields) {
- if (field.Name != field_name)
- continue;
-
- MarkField (field);
- }
- }
-
- void MarkNamedProperty (TypeDefinition type, string property_name)
- {
- if (!type.HasProperties)
- return;
-
- foreach (PropertyDefinition property in type.Properties) {
- if (property.Name != property_name)
- continue;
-
- Annotations.Push (property);
- MarkMethod (property.GetMethod);
- MarkMethod (property.SetMethod);
- Annotations.Pop ();
- }
- }
-
- void MarkGenericParameterProvider (IGenericParameterProvider provider)
- {
- if (!provider.HasGenericParameters)
- return;
-
- foreach (GenericParameter parameter in provider.GenericParameters)
- MarkGenericParameter (parameter);
- }
-
- void MarkGenericParameter (GenericParameter parameter)
- {
- MarkCustomAttributes (parameter);
- foreach (TypeReference constraint in parameter.Constraints)
- MarkType (constraint);
- }
-
- bool IsVirtualAndHasPreservedParent (MethodDefinition method)
- {
- if (!method.IsVirtual)
- return false;
-
- var base_list = Annotations.GetBaseMethods (method);
- if (base_list == null)
- return false;
-
- foreach (MethodDefinition @base in base_list) {
- if (IgnoreScope (@base.DeclaringType.Scope))
- return true;
-
- if (IsVirtualAndHasPreservedParent (@base))
- return true;
- }
-
- return false;
- }
-
- static MethodPredicate IsSpecialSerializationConstructorPredicate = new MethodPredicate (IsSpecialSerializationConstructor);
-
- static bool IsSpecialSerializationConstructor (MethodDefinition method)
- {
- if (!IsConstructor (method))
- return false;
-
- var parameters = method.Parameters;
- if (parameters.Count != 2)
- return false;
-
- return parameters [0].ParameterType.Name == "SerializationInfo" &&
- parameters [1].ParameterType.Name == "StreamingContext";
- }
-
- delegate bool MethodPredicate (MethodDefinition method);
-
- void MarkMethodsIf (ICollection methods, MethodPredicate predicate)
- {
- foreach (MethodDefinition method in methods)
- if (predicate (method)) {
- Annotations.Push (predicate);
- MarkMethod (method);
- Annotations.Pop ();
- }
- }
-
- static MethodPredicate IsDefaultConstructorPredicate = new MethodPredicate (IsDefaultConstructor);
-
- static bool IsDefaultConstructor (MethodDefinition method)
- {
- return IsConstructor (method) && !method.HasParameters;
- }
-
- static bool IsConstructor (MethodDefinition method)
- {
- return method.IsConstructor && !method.IsStatic;
- }
-
- protected void MarkDefaultConstructor (TypeDefinition type)
- {
- if ((type == null) || !type.HasMethods)
- return;
-
- MarkMethodsIf (type.Methods, IsDefaultConstructorPredicate);
- }
-
- static MethodPredicate IsStaticConstructorPredicate = new MethodPredicate (IsStaticConstructor);
-
- static bool IsStaticConstructor (MethodDefinition method)
- {
- return method.IsConstructor && method.IsStatic;
- }
-
- static bool HasSerializationAttribute (MethodDefinition method)
- {
- if (!method.HasCustomAttributes)
- return false;
- foreach (var ca in method.CustomAttributes) {
- var cat = ca.AttributeType;
- if (cat.Namespace != "System.Runtime.Serialization")
- continue;
- switch (cat.Name) {
- case "OnDeserializedAttribute":
- case "OnDeserializingAttribute":
- case "OnSerializedAttribute":
- case "OnSerializingAttribute":
- return true;
- }
- }
- return false;
- }
-
- static bool IsSerializable (TypeDefinition td)
- {
- return (td.Attributes & TypeAttributes.Serializable) != 0;
- }
-
- static bool IsMulticastDelegate (TypeDefinition td)
- {
- return td.BaseType != null && td.BaseType.FullName == "System.MulticastDelegate";
- }
-
- protected TypeDefinition ResolveTypeDefinition (TypeReference type)
- {
- TypeDefinition td = type as TypeDefinition;
- if (td == null)
- td = type.Resolve ();
-
- return td;
- }
-
- protected TypeReference GetOriginalType (TypeReference type)
- {
- while (type is TypeSpecification) {
- GenericInstanceType git = type as GenericInstanceType;
- if (git != null)
- MarkGenericArguments (git);
-
- var mod = type as IModifierType;
- if (mod != null)
- MarkModifierType (mod);
-
- type = ((TypeSpecification) type).ElementType;
- }
-
- return type;
- }
-
- void MarkModifierType (IModifierType mod)
- {
- MarkType (mod.ModifierType);
- }
-
- void MarkGenericArguments (IGenericInstance instance)
- {
- foreach (TypeReference argument in instance.GenericArguments)
- MarkType (argument);
-
- MarkGenericArgumentConstructors (instance);
- }
-
- void MarkGenericArgumentConstructors (IGenericInstance instance)
- {
- var arguments = instance.GenericArguments;
-
- var generic_element = GetGenericProviderFromInstance (instance);
- if (generic_element == null)
- return;
-
- var parameters = generic_element.GenericParameters;
-
- if (arguments.Count != parameters.Count)
- return;
-
- for (int i = 0; i < arguments.Count; i++) {
- var argument = arguments [i];
- var parameter = parameters [i];
-
- if (!parameter.HasDefaultConstructorConstraint)
- continue;
-
- var argument_definition = ResolveTypeDefinition (argument);
- if (argument_definition == null)
- continue;
-
- MarkMethodsIf (argument_definition.Methods, ctor => !ctor.IsStatic && !ctor.HasParameters);
- }
- }
-
- IGenericParameterProvider GetGenericProviderFromInstance (IGenericInstance instance)
- {
- var method = instance as GenericInstanceMethod;
- if (method != null)
- return ResolveMethodDefinition (method.ElementMethod);
-
- var type = instance as GenericInstanceType;
- if (type != null)
- return ResolveTypeDefinition (type.ElementType);
-
- return null;
- }
-
- void ApplyPreserveInfo (TypeDefinition type)
- {
- ApplyPreserveMethods (type);
-
- if (!Annotations.IsPreserved (type))
- return;
-
- switch (Annotations.GetPreserve (type)) {
- case TypePreserve.All:
- MarkFields (type, true);
- MarkMethods (type);
- break;
- case TypePreserve.Fields:
- MarkFields (type, true);
- break;
- case TypePreserve.Methods:
- MarkMethods (type);
- break;
- }
- }
-
- void ApplyPreserveMethods (TypeDefinition type)
- {
- var list = Annotations.GetPreservedMethods (type);
- if (list == null)
- return;
-
- MarkMethodCollection (list);
- }
-
- void ApplyPreserveMethods (MethodDefinition method)
- {
- var list = Annotations.GetPreservedMethods (method);
- if (list == null)
- return;
-
- MarkMethodCollection (list);
- }
-
- protected void MarkFields (TypeDefinition type, bool includeStatic)
- {
- if (!type.HasFields)
- return;
-
- foreach (FieldDefinition field in type.Fields) {
- if (!includeStatic && field.IsStatic)
- continue;
- MarkField (field);
- }
- }
-
- protected virtual void MarkMethods (TypeDefinition type)
- {
- if (type.HasMethods)
- MarkMethodCollection (type.Methods);
- }
-
- void MarkMethodCollection (IEnumerable methods)
- {
- foreach (MethodDefinition method in methods)
- MarkMethod (method);
- }
-
- protected virtual MethodDefinition MarkMethod (MethodReference reference)
- {
- reference = GetOriginalMethod (reference);
-
- if (reference.DeclaringType is ArrayType)
- return null;
-
- Annotations.Push (reference);
- if (reference.DeclaringType is GenericInstanceType)
- MarkType (reference.DeclaringType);
-
-// if (IgnoreScope (reference.DeclaringType.Scope))
-// return;
-
- MethodDefinition method = ResolveMethodDefinition (reference);
-
- if (method == null) {
- Annotations.Pop ();
- throw new ResolutionException (reference);
- }
-
- if (Annotations.GetAction (method) == MethodAction.Nothing)
- Annotations.SetAction (method, MethodAction.Parse);
-
- EnqueueMethod (method);
-
- Annotations.Pop ();
- Annotations.AddDependency (method);
-
- return method;
- }
-
- AssemblyDefinition ResolveAssembly (IMetadataScope scope)
- {
- AssemblyDefinition assembly = _context.Resolve (scope);
- MarkAssembly (assembly);
- return assembly;
- }
-
- protected MethodReference GetOriginalMethod (MethodReference method)
- {
- while (method is MethodSpecification) {
- GenericInstanceMethod gim = method as GenericInstanceMethod;
- if (gim != null)
- MarkGenericArguments (gim);
-
- method = ((MethodSpecification) method).ElementMethod;
- }
-
- return method;
- }
-
- MethodDefinition ResolveMethodDefinition (MethodReference method)
- {
- MethodDefinition md = method as MethodDefinition;
- if (md == null)
- md = method.Resolve ();
-
- return md;
- }
-
- protected virtual void ProcessMethod (MethodDefinition method)
- {
- if (CheckProcessed (method))
- return;
-
- Annotations.Push (method);
- MarkType (method.DeclaringType);
- MarkCustomAttributes (method);
- MarkSecurityDeclarations (method);
-
- MarkGenericParameterProvider (method);
-
- if (IsPropertyMethod (method))
- MarkProperty (GetProperty (method));
- else if (IsEventMethod (method))
- MarkEvent (GetEvent (method));
-
- if (method.HasParameters) {
- foreach (ParameterDefinition pd in method.Parameters) {
- MarkType (pd.ParameterType);
- MarkCustomAttributes (pd);
- MarkMarshalSpec (pd);
- }
- }
-
- if (method.HasOverrides) {
- foreach (MethodReference ov in method.Overrides)
- MarkMethod (ov);
- }
-
- MarkMethodSpecialCustomAttributes (method);
-
- if (method.IsVirtual)
- _virtual_methods.Add (method);
-
- MarkBaseMethods (method);
-
- MarkType (method.ReturnType);
- MarkCustomAttributes (method.MethodReturnType);
- MarkMarshalSpec (method.MethodReturnType);
-
- if (ShouldParseMethodBody (method))
- MarkMethodBody (method.Body);
-
- DoAdditionalMethodProcessing (method);
-
- Annotations.Mark (method);
-
- ApplyPreserveMethods (method);
- Annotations.Pop ();
- }
-
- // Allow subclassers to mark additional things when marking a method
- protected virtual void DoAdditionalMethodProcessing (MethodDefinition method)
- {
- }
-
- void MarkBaseMethods (MethodDefinition method)
- {
- IList base_methods = Annotations.GetBaseMethods (method);
- if (base_methods == null)
- return;
-
- foreach (MethodDefinition base_method in base_methods) {
- if (base_method.DeclaringType.IsInterface && !method.DeclaringType.IsInterface)
- continue;
-
- MarkMethod (base_method);
- MarkBaseMethods (base_method);
- }
- }
-
- bool ShouldParseMethodBody (MethodDefinition method)
- {
- if (!method.HasBody)
- return false;
-
- AssemblyDefinition assembly = ResolveAssembly (method.DeclaringType.Scope);
- return (Annotations.GetAction (method) == MethodAction.ForceParse ||
- (Annotations.GetAction (assembly) == AssemblyAction.Link && Annotations.GetAction (method) == MethodAction.Parse));
- }
-
- static internal bool IsPropertyMethod (MethodDefinition md)
- {
- return (md.SemanticsAttributes & MethodSemanticsAttributes.Getter) != 0 ||
- (md.SemanticsAttributes & MethodSemanticsAttributes.Setter) != 0;
- }
-
- static bool IsEventMethod (MethodDefinition md)
- {
- return (md.SemanticsAttributes & MethodSemanticsAttributes.AddOn) != 0 ||
- (md.SemanticsAttributes & MethodSemanticsAttributes.Fire) != 0 ||
- (md.SemanticsAttributes & MethodSemanticsAttributes.RemoveOn) != 0;
- }
-
- static internal PropertyDefinition GetProperty (MethodDefinition md)
- {
- TypeDefinition declaringType = (TypeDefinition) md.DeclaringType;
- foreach (PropertyDefinition prop in declaringType.Properties)
- if (prop.GetMethod == md || prop.SetMethod == md)
- return prop;
-
- return null;
- }
-
- static EventDefinition GetEvent (MethodDefinition md)
- {
- TypeDefinition declaringType = (TypeDefinition) md.DeclaringType;
- foreach (EventDefinition evt in declaringType.Events)
- if (evt.AddMethod == md || evt.InvokeMethod == md || evt.RemoveMethod == md)
- return evt;
-
- return null;
- }
-
- protected void MarkProperty (PropertyDefinition prop)
- {
- MarkCustomAttributes (prop);
- }
-
- protected void MarkEvent (EventDefinition evt)
- {
- MarkCustomAttributes (evt);
- MarkMethodIfNotNull (evt.AddMethod);
- MarkMethodIfNotNull (evt.InvokeMethod);
- MarkMethodIfNotNull (evt.RemoveMethod);
- }
-
- void MarkMethodIfNotNull (MethodReference method)
- {
- if (method == null)
- return;
-
- MarkMethod (method);
- }
-
- protected virtual void MarkMethodBody (MethodBody body)
- {
- foreach (VariableDefinition var in body.Variables)
- MarkType (var.VariableType);
-
- foreach (ExceptionHandler eh in body.ExceptionHandlers)
- if (eh.HandlerType == ExceptionHandlerType.Catch)
- MarkType (eh.CatchType);
-
- foreach (Instruction instruction in body.Instructions)
- MarkInstruction (instruction);
- }
-
- protected virtual void MarkInstruction (Instruction instruction)
- {
- switch (instruction.OpCode.OperandType) {
- case OperandType.InlineField:
- MarkField ((FieldReference) instruction.Operand);
- break;
- case OperandType.InlineMethod:
- MarkMethod ((MethodReference) instruction.Operand);
- break;
- case OperandType.InlineTok:
- object token = instruction.Operand;
- if (token is TypeReference)
- MarkType ((TypeReference) token);
- else if (token is MethodReference)
- MarkMethod ((MethodReference) token);
- else
- MarkField ((FieldReference) token);
- break;
- case OperandType.InlineType:
- MarkType ((TypeReference) instruction.Operand);
- break;
- default:
- break;
- }
- }
- }
-}
+++ /dev/null
-//
-// OutputStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker.Steps {
-
- public class OutputStep : BaseStep {
-
- protected override void Process ()
- {
- CheckOutputDirectory ();
- Annotations.SaveDependencies ();
- }
-
- void CheckOutputDirectory ()
- {
- if (Directory.Exists (Context.OutputDirectory))
- return;
-
- Directory.CreateDirectory (Context.OutputDirectory);
- }
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- OutputAssembly (assembly);
- }
-
- void OutputAssembly (AssemblyDefinition assembly)
- {
- string directory = Context.OutputDirectory;
-
- CopyConfigFileIfNeeded (assembly, directory);
-
- switch (Annotations.GetAction (assembly)) {
- case AssemblyAction.Save:
- case AssemblyAction.Link:
- Context.Annotations.AddDependency (assembly);
- assembly.Write (GetAssemblyFileName (assembly, directory), SaveSymbols (assembly));
- break;
- case AssemblyAction.Copy:
- Context.Annotations.AddDependency (assembly);
- CloseSymbols (assembly);
- CopyAssembly (GetOriginalAssemblyFileInfo (assembly), directory, Context.LinkSymbols);
- break;
- case AssemblyAction.Delete:
- CloseSymbols (assembly);
- var target = GetAssemblyFileName (assembly, directory);
- if (File.Exists (target)) {
- File.Delete (target);
- File.Delete (target + ".mdb");
- File.Delete (GetConfigFile (target));
- }
- break;
- default:
- CloseSymbols (assembly);
- break;
- }
- }
-
- void CloseSymbols (AssemblyDefinition assembly)
- {
- Annotations.CloseSymbolReader (assembly);
- }
-
- WriterParameters SaveSymbols (AssemblyDefinition assembly)
- {
- var parameters = new WriterParameters ();
- if (!Context.LinkSymbols)
- return parameters;
-
- if (!assembly.MainModule.HasSymbols)
- return parameters;
-
- if (Context.SymbolWriterProvider != null)
- parameters.SymbolWriterProvider = Context.SymbolWriterProvider;
- else
- parameters.WriteSymbols = true;
- return parameters;
- }
-
- static void CopyConfigFileIfNeeded (AssemblyDefinition assembly, string directory)
- {
- string config = GetConfigFile (GetOriginalAssemblyFileInfo (assembly).FullName);
- if (!File.Exists (config))
- return;
-
- string target = Path.GetFullPath (GetConfigFile (GetAssemblyFileName (assembly, directory)));
-
- if (config == target)
- return;
-
- File.Copy (config, GetConfigFile (GetAssemblyFileName (assembly, directory)), true);
- }
-
- static string GetConfigFile (string assembly)
- {
- return assembly + ".config";
- }
-
- static FileInfo GetOriginalAssemblyFileInfo (AssemblyDefinition assembly)
- {
- return new FileInfo (assembly.MainModule.FileName);
- }
-
- static void CopyAssembly (FileInfo fi, string directory, bool symbols)
- {
- string target = Path.GetFullPath (Path.Combine (directory, fi.Name));
- string source = fi.FullName;
- if (source == target)
- return;
-
- File.Copy (source, target, true);
-
- if (!symbols)
- return;
-
- source += ".mdb";
- if (!File.Exists (source))
- return;
- File.Copy (source, target + ".mdb", true);
- }
-
- static string GetAssemblyFileName (AssemblyDefinition assembly, string directory)
- {
- string file = assembly.Name.Name + (assembly.MainModule.Kind == ModuleKind.Dll ? ".dll" : ".exe");
- return Path.Combine (directory, file);
- }
- }
-}
+++ /dev/null
-//
-// CleanStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class RegenerateGuidStep : BaseStep {
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) == AssemblyAction.Link)
- RegenerateGuid (assembly);
- }
-
- static void RegenerateGuid (AssemblyDefinition asm)
- {
- asm.MainModule.Mvid = Guid.NewGuid ();
- }
- }
-}
+++ /dev/null
-//
-// ResolveFromAssemblyStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class ResolveFromAssemblyStep : ResolveStep {
-
- AssemblyDefinition _assembly;
- string _file;
-
- public ResolveFromAssemblyStep (string assembly)
- {
- _file = assembly;
- }
-
- public ResolveFromAssemblyStep (AssemblyDefinition assembly)
- {
- _assembly = assembly;
- }
-
- protected override void Process ()
- {
- if (_assembly != null)
- Context.Resolver.CacheAssembly (_assembly);
-
- AssemblyDefinition assembly = _assembly ?? Context.Resolve (_file);
-
- switch (assembly.MainModule.Kind) {
- case ModuleKind.Dll:
- ProcessLibrary (Context, assembly);
- break;
- default:
- ProcessExecutable (assembly);
- break;
- }
- }
-
- static void SetAction (LinkContext context, AssemblyDefinition assembly, AssemblyAction action)
- {
- TryReadSymbols (context, assembly);
-
- context.Annotations.SetAction (assembly, action);
- }
-
- static void TryReadSymbols (LinkContext context, AssemblyDefinition assembly)
- {
- context.SafeReadSymbols (assembly);
- }
-
- public static void ProcessLibrary (LinkContext context, AssemblyDefinition assembly)
- {
- SetAction (context, assembly, AssemblyAction.Copy);
-
- context.Annotations.Push (assembly);
-
- foreach (TypeDefinition type in assembly.MainModule.Types)
- MarkType (context, type);
-
- context.Annotations.Pop ();
- }
-
- static void MarkType (LinkContext context, TypeDefinition type)
- {
- context.Annotations.Mark (type);
-
- context.Annotations.Push (type);
-
- if (type.HasFields)
- MarkFields (context, type.Fields);
- if (type.HasMethods)
- MarkMethods (context, type.Methods);
- if (type.HasNestedTypes)
- foreach (var nested in type.NestedTypes)
- MarkType (context, nested);
-
- context.Annotations.Pop ();
- }
-
- void ProcessExecutable (AssemblyDefinition assembly)
- {
- SetAction (Context, assembly, AssemblyAction.Link);
-
- Annotations.Push (assembly);
-
- Annotations.Mark (assembly.EntryPoint.DeclaringType);
- MarkMethod (Context, assembly.EntryPoint, MethodAction.Parse);
-
- Annotations.Pop ();
- }
-
- static void MarkFields (LinkContext context, ICollection fields)
- {
- foreach (FieldDefinition field in fields)
- context.Annotations.Mark (field);
- }
-
- static void MarkMethods (LinkContext context, ICollection methods)
- {
- foreach (MethodDefinition method in methods)
- MarkMethod (context, method, MethodAction.ForceParse);
- }
-
- static void MarkMethod (LinkContext context, MethodDefinition method, MethodAction action)
- {
- context.Annotations.Mark (method);
- context.Annotations.SetAction (method, action);
- }
- }
-}
+++ /dev/null
-//
-// ResolveFromXApiStep.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Xml.XPath;
-
-using Mono.Linker;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class ResolveFromXApiStep : ResolveStep, IXApiVisitor {
-
- static readonly string _name = "name";
- static readonly string _ns = string.Empty;
-
- XPathDocument _document;
-
- public ResolveFromXApiStep (XPathDocument document)
- {
- _document = document;
- }
-
- protected override void Process ()
- {
- XApiReader reader = new XApiReader (_document, this);
- reader.Process (Context);
- }
-
- public void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly)
- {
- }
-
- public void OnAttribute (XPathNavigator nav)
- {
- string name = GetName (nav);
-
- TypeDefinition type = Context.GetType (name);
- if (type != null)
- MarkType (type);
- }
-
- public void OnClass (XPathNavigator nav, TypeDefinition type)
- {
- MarkType (type);
- }
-
- public void OnInterface (XPathNavigator nav, TypeDefinition type)
- {
- MarkType (type);
- }
-
- public void OnField (XPathNavigator nav, FieldDefinition field)
- {
- MarkField (field);
- }
-
- public void OnMethod (XPathNavigator nav, MethodDefinition method)
- {
- MarkMethod (method);
- }
-
- public void OnConstructor (XPathNavigator nav, MethodDefinition method)
- {
- MarkMethod (method);
- }
-
- public void OnProperty (XPathNavigator nav, PropertyDefinition property)
- {
- }
-
- public void OnEvent (XPathNavigator nav, EventDefinition evt)
- {
- if (evt.AddMethod != null)
- MarkMethod (evt.AddMethod);
- if (evt.InvokeMethod != null)
- MarkMethod (evt.InvokeMethod);
- if (evt.RemoveMethod != null)
- MarkMethod (evt.RemoveMethod);
- }
-
- static string GetName (XPathNavigator nav)
- {
- return GetAttribute (nav, _name);
- }
-
- static string GetAttribute (XPathNavigator nav, string attribute)
- {
- return nav.GetAttribute (attribute, _ns);
- }
-
- void MarkType (TypeDefinition type)
- {
- InternalMark (type);
- }
-
- void MarkField (FieldDefinition field)
- {
- InternalMark (field);
- }
-
- void InternalMark (IMetadataTokenProvider provider)
- {
- Annotations.Mark (provider);
- Annotations.SetPublic (provider);
- }
-
- void MarkMethod (MethodDefinition method)
- {
- InternalMark (method);
- Annotations.SetAction (method, MethodAction.Parse);
- }
- }
-}
+++ /dev/null
-//
-// ResolveFromXmlStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-// Copyright 2013 Xamarin Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using SR = System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class XmlResolutionException : Exception {
- public XmlResolutionException (string message, Exception innerException)
- : base (message, innerException)
- {
- }
- }
-
- public class ResolveFromXmlStep : ResolveStep {
-
- static readonly string _signature = "signature";
- static readonly string _fullname = "fullname";
- static readonly string _required = "required";
- static readonly string _preserve = "preserve";
- static readonly string _ns = string.Empty;
-
- XPathDocument _document;
- string _xmlDocumentLocation;
-
- public ResolveFromXmlStep (XPathDocument document, string xmlDocumentLocation = "<unspecified>")
- {
- _document = document;
- _xmlDocumentLocation = xmlDocumentLocation;
- }
-
- protected override void Process ()
- {
- XPathNavigator nav = _document.CreateNavigator ();
- nav.MoveToFirstChild ();
-
- // This step can be created with XML files that aren't necessarily
- // linker descriptor files. So bail if we don't have a <linker> element.
- if (nav.LocalName != "linker")
- return;
-
- try {
- ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns));
- } catch (Exception ex) {
- throw new XmlResolutionException (string.Format ("Failed to process XML description: {0}", _xmlDocumentLocation), ex);
- }
- }
-
- void ProcessAssemblies (LinkContext context, XPathNodeIterator iterator)
- {
- while (iterator.MoveNext ()) {
- AssemblyDefinition assembly = GetAssembly (context, GetFullName (iterator.Current));
- ProcessTypes (assembly, iterator.Current.SelectChildren ("type", _ns));
- ProcessNamespaces (assembly, iterator.Current.SelectChildren ("namespace", _ns));
- }
- }
-
- void ProcessNamespaces (AssemblyDefinition assembly, XPathNodeIterator iterator)
- {
- while (iterator.MoveNext ()) {
- string fullname = GetFullName (iterator.Current);
- foreach (TypeDefinition type in assembly.MainModule.Types) {
- if (type.Namespace != fullname)
- continue;
-
- MarkAndPreserveAll (type);
- }
- }
- }
-
- void MarkAndPreserveAll (TypeDefinition type)
- {
- Annotations.Mark (type);
- Annotations.SetPreserve (type, TypePreserve.All);
-
- if (!type.HasNestedTypes)
- return;
-
- foreach (TypeDefinition nested in type.NestedTypes)
- MarkAndPreserveAll (nested);
- }
-
- void ProcessTypes (AssemblyDefinition assembly, XPathNodeIterator iterator)
- {
- while (iterator.MoveNext ()) {
- XPathNavigator nav = iterator.Current;
- string fullname = GetFullName (nav);
-
- if (IsTypePattern (fullname)) {
- ProcessTypePattern (fullname, assembly, nav);
- continue;
- }
-
- TypeDefinition type = assembly.MainModule.GetType (fullname);
- if (type == null)
- continue;
-
- ProcessType (type, nav);
- }
- }
-
- static bool IsTypePattern (string fullname)
- {
- return fullname.IndexOf ("*") != -1;
- }
-
- static Regex CreateRegexFromPattern (string pattern)
- {
- return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
- }
-
- void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav)
- {
- if (regex.Match (type.FullName).Success)
- ProcessType (type, nav);
-
- if (!type.HasNestedTypes)
- return;
-
- foreach (var nt in type.NestedTypes)
- MatchType (nt, regex, nav);
- }
-
- void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav)
- {
- Regex regex = CreateRegexFromPattern (fullname);
-
- foreach (TypeDefinition type in assembly.MainModule.Types) {
- MatchType (type, regex, nav);
- }
- }
-
- void ProcessType (TypeDefinition type, XPathNavigator nav)
- {
- TypePreserve preserve = GetTypePreserve (nav);
-
- if (!IsRequired (nav)) {
- Annotations.SetPreserve (type, preserve);
- return;
- }
-
- Annotations.Mark (type);
-
- if (type.IsNested) {
- var parent = type;
- while (parent.IsNested) {
- parent = parent.DeclaringType;
- Annotations.Mark (parent);
- }
- }
-
- switch (preserve) {
- case TypePreserve.Nothing:
- if (!nav.HasChildren)
- Annotations.SetPreserve (type, TypePreserve.All);
- break;
- default:
- Annotations.SetPreserve (type, preserve);
- break;
- }
-
- if (nav.HasChildren) {
- MarkSelectedFields (nav, type);
- MarkSelectedMethods (nav, type);
- }
- }
-
- void MarkSelectedFields (XPathNavigator nav, TypeDefinition type)
- {
- XPathNodeIterator fields = nav.SelectChildren ("field", _ns);
- if (fields.Count == 0)
- return;
-
- ProcessFields (type, fields);
- }
-
- void MarkSelectedMethods (XPathNavigator nav, TypeDefinition type)
- {
- XPathNodeIterator methods = nav.SelectChildren ("method", _ns);
- if (methods.Count == 0)
- return;
-
- ProcessMethods (type, methods);
- }
-
- static TypePreserve GetTypePreserve (XPathNavigator nav)
- {
- string attribute = GetAttribute (nav, _preserve);
- if (attribute == null || attribute.Length == 0)
- return TypePreserve.Nothing;
-
- try {
- return (TypePreserve) Enum.Parse (typeof (TypePreserve), attribute, true);
- } catch {
- return TypePreserve.Nothing;
- }
- }
-
- void ProcessFields (TypeDefinition type, XPathNodeIterator iterator)
- {
- while (iterator.MoveNext ()) {
- string value = GetSignature (iterator.Current);
- if (!String.IsNullOrEmpty (value))
- ProcessFieldSignature (type, value);
-
- value = GetAttribute (iterator.Current, "name");
- if (!String.IsNullOrEmpty (value))
- ProcessFieldName (type, value);
- }
- }
-
- void ProcessFieldSignature (TypeDefinition type, string signature)
- {
- FieldDefinition field = GetField (type, signature);
- MarkField (type, field, signature);
- }
-
- void MarkField (TypeDefinition type, FieldDefinition field, string signature)
- {
- if (field != null)
- Annotations.Mark (field);
- else
- AddUnresolveMarker (string.Format ("T: {0}; F: {1}", type, signature));
- }
-
- void ProcessFieldName (TypeDefinition type, string name)
- {
- if (!type.HasFields)
- return;
-
- foreach (FieldDefinition field in type.Fields)
- if (field.Name == name)
- MarkField (type, field, name);
- }
-
- static FieldDefinition GetField (TypeDefinition type, string signature)
- {
- if (!type.HasFields)
- return null;
-
- foreach (FieldDefinition field in type.Fields)
- if (signature == GetFieldSignature (field))
- return field;
-
- return null;
- }
-
- static string GetFieldSignature (FieldDefinition field)
- {
- return field.FieldType.FullName + " " + field.Name;
- }
-
- void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator)
- {
- while (iterator.MoveNext()) {
- string value = GetSignature (iterator.Current);
- if (!String.IsNullOrEmpty (value))
- ProcessMethodSignature (type, value);
-
- value = GetAttribute (iterator.Current, "name");
- if (!String.IsNullOrEmpty (value))
- ProcessMethodName (type, value);
- }
- }
-
- void ProcessMethodSignature (TypeDefinition type, string signature)
- {
- MethodDefinition meth = GetMethod (type, signature);
- MarkMethod (type, meth, signature);
- }
-
- void MarkMethod (TypeDefinition type, MethodDefinition method, string signature)
- {
- if (method != null) {
- Annotations.Mark (method);
- Annotations.SetAction (method, MethodAction.Parse);
- } else
- AddUnresolveMarker (string.Format ("T: {0}; M: {1}", type, signature));
- }
-
- void ProcessMethodName (TypeDefinition type, string name)
- {
- if (!type.HasMethods)
- return;
-
- foreach (MethodDefinition method in type.Methods)
- if (name == method.Name)
- MarkMethod (type, method, name);
- }
-
- static MethodDefinition GetMethod (TypeDefinition type, string signature)
- {
- if (type.HasMethods)
- foreach (MethodDefinition meth in type.Methods)
- if (signature == GetMethodSignature (meth))
- return meth;
-
- return null;
- }
-
- static string GetMethodSignature (MethodDefinition meth)
- {
- StringBuilder sb = new StringBuilder ();
- sb.Append (meth.ReturnType.FullName);
- sb.Append (" ");
- sb.Append (meth.Name);
- sb.Append ("(");
- if (meth.HasParameters) {
- for (int i = 0; i < meth.Parameters.Count; i++) {
- if (i > 0)
- sb.Append (",");
-
- sb.Append (meth.Parameters [i].ParameterType.FullName);
- }
- }
- sb.Append (")");
- return sb.ToString ();
- }
-
- static AssemblyDefinition GetAssembly (LinkContext context, string assemblyName)
- {
- AssemblyNameReference reference = AssemblyNameReference.Parse (assemblyName);
- AssemblyDefinition assembly;
-
- assembly = context.Resolve (reference);
-
- ProcessReferences (assembly, context);
- return assembly;
- }
-
- static void ProcessReferences (AssemblyDefinition assembly, LinkContext context)
- {
- foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
- context.Resolve (name);
- }
-
- static bool IsRequired (XPathNavigator nav)
- {
- string attribute = GetAttribute (nav, _required);
- if (attribute == null || attribute.Length == 0)
- return true;
-
- return TryParseBool (attribute);
- }
-
- static bool TryParseBool (string s)
- {
- try {
- return bool.Parse (s);
- } catch {
- return false;
- }
- }
-
- static string GetSignature (XPathNavigator nav)
- {
- return GetAttribute (nav, _signature);
- }
-
- static string GetFullName (XPathNavigator nav)
- {
- return GetAttribute (nav, _fullname);
- }
-
- static string GetAttribute (XPathNavigator nav, string attribute)
- {
- return nav.GetAttribute (attribute, _ns);
- }
- }
-}
+++ /dev/null
-//
-// ResolveStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Linker.Steps {
-
- using System.Collections;
-
- public abstract class ResolveStep : BaseStep {
-
- ArrayList _unResolved;
-
- internal ResolveStep ()
- {
- _unResolved = new ArrayList ();
- }
-
- public bool AllMarkerResolved
- {
- get { return _unResolved.Count == 0; }
- }
-
- public string [] GetUnresolvedMarkers ()
- {
- return _unResolved.ToArray (typeof (string)) as string [];
- }
-
- protected void AddUnresolveMarker (string signature)
- {
- _unResolved.Add (signature);
- }
- }
-}
+++ /dev/null
-//
-// SweepStep.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.Collections.Generic;
-using Mono.Cecil;
-using Mono.Collections.Generic;
-
-namespace Mono.Linker.Steps {
-
- public class SweepStep : BaseStep {
-
- AssemblyDefinition [] assemblies;
- HashSet<AssemblyDefinition> resolvedTypeReferences;
-
- protected override void Process ()
- {
- assemblies = Context.GetAssemblies ();
- foreach (var assembly in assemblies) {
- SweepAssembly (assembly);
- if (Annotations.GetAction (assembly) == AssemblyAction.Copy) {
- // Copy assemblies can still contain Type references with
- // type forwarders from Delete assemblies
- // thus try to resolve all the type references and see
- // if some changed the scope. if yes change the action to Save
- if (ResolveAllTypeReferences (assembly))
- Annotations.SetAction (assembly, AssemblyAction.Save);
- }
- }
- }
-
- void SweepAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- if (!IsMarkedAssembly (assembly)) {
- RemoveAssembly (assembly);
- return;
- }
-
- var types = new List<TypeDefinition> ();
-
- foreach (TypeDefinition type in assembly.MainModule.Types) {
- if (Annotations.IsMarked (type)) {
- SweepType (type);
- types.Add (type);
- continue;
- }
-
- if (type.Name == "<Module>")
- types.Add (type);
- }
-
- assembly.MainModule.Types.Clear ();
- foreach (TypeDefinition type in types)
- assembly.MainModule.Types.Add (type);
- }
-
- bool IsMarkedAssembly (AssemblyDefinition assembly)
- {
- return Annotations.IsMarked (assembly.MainModule);
- }
-
- void RemoveAssembly (AssemblyDefinition assembly)
- {
- Annotations.SetAction (assembly, AssemblyAction.Delete);
-
- SweepReferences (assembly);
- }
-
- void SweepReferences (AssemblyDefinition target)
- {
- foreach (var assembly in assemblies)
- SweepReferences (assembly, target);
- }
-
- void SweepReferences (AssemblyDefinition assembly, AssemblyDefinition target)
- {
- if (assembly == target)
- return;
-
- var references = assembly.MainModule.AssemblyReferences;
- for (int i = 0; i < references.Count; i++) {
- var reference = references [i];
- var r = Context.Resolver.Resolve (reference);
- if (!AreSameReference (r.Name, target.Name))
- continue;
-
- references.RemoveAt (i);
- // Removing the reference does not mean it will be saved back to disk!
- // That depends on the AssemblyAction set for the `assembly`
- switch (Annotations.GetAction (assembly)) {
- case AssemblyAction.Copy:
- // Copy means even if "unlinked" we still want that assembly to be saved back
- // to disk (OutputStep) without the (removed) reference
- Annotations.SetAction (assembly, AssemblyAction.Save);
- ResolveAllTypeReferences (assembly);
- break;
-
- case AssemblyAction.Save:
- case AssemblyAction.Link:
- ResolveAllTypeReferences (assembly);
- break;
- }
- return;
- }
- }
-
- bool ResolveAllTypeReferences (AssemblyDefinition assembly)
- {
- if (resolvedTypeReferences == null)
- resolvedTypeReferences = new HashSet<AssemblyDefinition> ();
- if (resolvedTypeReferences.Contains (assembly))
- return false;
- resolvedTypeReferences.Add (assembly);
-
- var hash = new Dictionary<TypeReference,IMetadataScope> ();
- bool changes = false;
-
- foreach (TypeReference tr in assembly.MainModule.GetTypeReferences ()) {
- if (hash.ContainsKey (tr))
- continue;
- var td = tr.Resolve ();
- IMetadataScope scope = tr.Scope;
- // at this stage reference might include things that can't be resolved
- // and if it is (resolved) it needs to be kept only if marked (#16213)
- if ((td != null) && Annotations.IsMarked (td)) {
- scope = assembly.MainModule.ImportReference (td).Scope;
- if (tr.Scope != scope)
- changes = true;
- hash.Add (tr, scope);
- }
- }
- if (assembly.MainModule.HasExportedTypes) {
- foreach (var et in assembly.MainModule.ExportedTypes) {
- var td = et.Resolve ();
- IMetadataScope scope = et.Scope;
- if ((td != null) && Annotations.IsMarked (td)) {
- scope = assembly.MainModule.ImportReference (td).Scope;
- hash.Add (td, scope);
- }
- }
- }
-
- // Resolve everything first before updating scopes.
- // If we set the scope to null, then calling Resolve() on any of its
- // nested types would crash.
-
- foreach (var e in hash) {
- e.Key.Scope = e.Value;
- }
-
- return changes;
- }
-
- void SweepType (TypeDefinition type)
- {
- if (type.HasFields)
- SweepCollection (type.Fields);
-
- if (type.HasMethods)
- SweepCollection (type.Methods);
-
- if (type.HasNestedTypes)
- SweepNestedTypes (type);
- }
-
- void SweepNestedTypes (TypeDefinition type)
- {
- for (int i = 0; i < type.NestedTypes.Count; i++) {
- var nested = type.NestedTypes [i];
- if (Annotations.IsMarked (nested)) {
- SweepType (nested);
- } else {
- type.NestedTypes.RemoveAt (i--);
- }
- }
- }
-
- void SweepCollection (IList list)
- {
- for (int i = 0; i < list.Count; i++)
- if (!Annotations.IsMarked ((IMetadataTokenProvider) list [i]))
- list.RemoveAt (i--);
- }
-
- static bool AreSameReference (AssemblyNameReference a, AssemblyNameReference b)
- {
- if (a == b)
- return true;
-
- if (a.Name != b.Name)
- return false;
-
- if (a.Version > b.Version)
- return false;
-
- return true;
- }
- }
-}
+++ /dev/null
-//
-// TypeMapStep.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
- public class TypeMapStep : BaseStep {
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- foreach (TypeDefinition type in assembly.MainModule.Types)
- MapType (type);
- }
-
- protected virtual void MapType (TypeDefinition type)
- {
- MapVirtualMethods (type);
- MapInterfaceMethodsInTypeHierarchy (type);
-
- if (!type.HasNestedTypes)
- return;
-
- foreach (var nested in type.NestedTypes)
- MapType (nested);
- }
-
- void MapInterfaceMethodsInTypeHierarchy (TypeDefinition type)
- {
- if (!type.HasInterfaces)
- return;
-
- foreach (var @interface in type.Interfaces) {
- var iface = @interface.InterfaceType.Resolve ();
- if (iface == null || !iface.HasMethods)
- continue;
-
- foreach (MethodDefinition method in iface.Methods) {
- if (TryMatchMethod (type, method) != null)
- continue;
-
- var @base = GetBaseMethodInTypeHierarchy (type, method);
- if (@base == null)
- continue;
-
- Annotations.AddPreservedMethod (type, @base);
- }
- }
- }
-
- void MapVirtualMethods (TypeDefinition type)
- {
- if (!type.HasMethods)
- return;
-
- foreach (MethodDefinition method in type.Methods) {
- if (!method.IsVirtual)
- continue;
-
- MapVirtualMethod (method);
-
- if (method.HasOverrides)
- MapOverrides (method);
- }
- }
-
- void MapVirtualMethod (MethodDefinition method)
- {
- MapVirtualBaseMethod (method);
- MapVirtualInterfaceMethod (method);
- }
-
- void MapVirtualBaseMethod (MethodDefinition method)
- {
- MethodDefinition @base = GetBaseMethodInTypeHierarchy (method);
- if (@base == null)
- return;
-
- AnnotateMethods (@base, method);
- }
-
- void MapVirtualInterfaceMethod (MethodDefinition method)
- {
- foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (method))
- AnnotateMethods (@base, method);
- }
-
- void MapOverrides (MethodDefinition method)
- {
- foreach (MethodReference override_ref in method.Overrides) {
- MethodDefinition @override = override_ref.Resolve ();
- if (@override == null)
- continue;
-
- AnnotateMethods (@override, method);
- }
- }
-
- void AnnotateMethods (MethodDefinition @base, MethodDefinition @override)
- {
- Annotations.AddBaseMethod (@override, @base);
- Annotations.AddOverride (@base, @override);
- }
-
- static MethodDefinition GetBaseMethodInTypeHierarchy (MethodDefinition method)
- {
- return GetBaseMethodInTypeHierarchy (method.DeclaringType, method);
- }
-
- static MethodDefinition GetBaseMethodInTypeHierarchy (TypeDefinition type, MethodDefinition method)
- {
- TypeDefinition @base = GetBaseType (type);
- while (@base != null) {
- MethodDefinition base_method = TryMatchMethod (@base, method);
- if (base_method != null)
- return base_method;
-
- @base = GetBaseType (@base);
- }
-
- return null;
- }
-
- static IEnumerable<MethodDefinition> GetBaseMethodsInInterfaceHierarchy (MethodDefinition method)
- {
- return GetBaseMethodsInInterfaceHierarchy (method.DeclaringType, method);
- }
-
- static IEnumerable<MethodDefinition> GetBaseMethodsInInterfaceHierarchy (TypeDefinition type, MethodDefinition method)
- {
- if (!type.HasInterfaces)
- yield break;
-
- foreach (var interface_ref in type.Interfaces) {
- TypeDefinition @interface = interface_ref.InterfaceType.Resolve ();
- if (@interface == null)
- continue;
-
- MethodDefinition base_method = TryMatchMethod (@interface, method);
- if (base_method != null)
- yield return base_method;
-
- foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (@interface, method))
- yield return @base;
- }
- }
-
- static MethodDefinition TryMatchMethod (TypeDefinition type, MethodDefinition method)
- {
- if (!type.HasMethods)
- return null;
-
- Dictionary<string,string> gp = null;
- foreach (MethodDefinition candidate in type.Methods) {
- if (MethodMatch (candidate, method, ref gp))
- return candidate;
- if (gp != null)
- gp.Clear ();
- }
-
- return null;
- }
-
- static bool MethodMatch (MethodDefinition candidate, MethodDefinition method, ref Dictionary<string,string> genericParameters)
- {
- if (!candidate.IsVirtual)
- return false;
-
- if (candidate.HasParameters != method.HasParameters)
- return false;
-
- if (candidate.Name != method.Name)
- return false;
-
- if (candidate.HasGenericParameters != method.HasGenericParameters)
- return false;
-
- // we need to track what the generic parameter represent - as we cannot allow it to
- // differ between the return type or any parameter
- if (!TypeMatch (candidate.ReturnType, method.ReturnType, ref genericParameters))
- return false;
-
- if (!candidate.HasParameters)
- return true;
-
- var cp = candidate.Parameters;
- var mp = method.Parameters;
- if (cp.Count != mp.Count)
- return false;
-
- for (int i = 0; i < cp.Count; i++) {
- if (!TypeMatch (cp [i].ParameterType, mp [i].ParameterType, ref genericParameters))
- return false;
- }
-
- return true;
- }
-
- static bool TypeMatch (IModifierType a, IModifierType b, ref Dictionary<string,string> gp)
- {
- if (!TypeMatch (a.ModifierType, b.ModifierType, ref gp))
- return false;
-
- return TypeMatch (a.ElementType, b.ElementType, ref gp);
- }
-
- static bool TypeMatch (TypeSpecification a, TypeSpecification b, ref Dictionary<string,string> gp)
- {
- var gita = a as GenericInstanceType;
- if (gita != null)
- return TypeMatch (gita, (GenericInstanceType) b, ref gp);
-
- var mta = a as IModifierType;
- if (mta != null)
- return TypeMatch (mta, (IModifierType) b, ref gp);
-
- return TypeMatch (a.ElementType, b.ElementType, ref gp);
- }
-
- static bool TypeMatch (GenericInstanceType a, GenericInstanceType b, ref Dictionary<string,string> gp)
- {
- if (!TypeMatch (a.ElementType, b.ElementType, ref gp))
- return false;
-
- if (a.HasGenericArguments != b.HasGenericArguments)
- return false;
-
- if (!a.HasGenericArguments)
- return true;
-
- var gaa = a.GenericArguments;
- var gab = b.GenericArguments;
- if (gaa.Count != gab.Count)
- return false;
-
- for (int i = 0; i < gaa.Count; i++) {
- if (!TypeMatch (gaa [i], gab [i], ref gp))
- return false;
- }
-
- return true;
- }
-
- static bool TypeMatch (TypeReference a, TypeReference b, ref Dictionary<string,string> gp)
- {
- var gpa = a as GenericParameter;
- if (gpa != null) {
- if (gp == null)
- gp = new Dictionary<string, string> ();
- string match;
- if (!gp.TryGetValue (gpa.FullName, out match)) {
- // first use, we assume it will always be used this way
- gp.Add (gpa.FullName, b.ToString ());
- return true;
- }
- // re-use, it should match the previous usage
- return match == b.ToString ();
- }
-
- if (a is TypeSpecification || b is TypeSpecification) {
- if (a.GetType () != b.GetType ())
- return false;
-
- return TypeMatch ((TypeSpecification) a, (TypeSpecification) b, ref gp);
- }
-
- return a.FullName == b.FullName;
- }
-
- static TypeDefinition GetBaseType (TypeDefinition type)
- {
- if (type == null || type.BaseType == null)
- return null;
-
- return type.BaseType.Resolve ();
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Mono.Linker</RootNamespace>
- <AssemblyName>monolinker</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>True</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>False</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>True</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Mono.Linker.Steps\BaseStep.cs" />
- <Compile Include="Mono.Linker.Steps\BlacklistStep.cs" />
- <Compile Include="Mono.Linker.Steps\CleanStep.cs" />
- <Compile Include="Mono.Linker.Steps\RegenerateGuidStep.cs" />
- <Compile Include="Mono.Linker.Steps\LoadI18nAssemblies.cs" />
- <Compile Include="Mono.Linker\IXApiVisitor.cs" />
- <Compile Include="Mono.Linker\I18nAssemblies.cs" />
- <Compile Include="Mono.Linker.Steps\IStep.cs" />
- <Compile Include="Mono.Linker.Steps\LoadReferencesStep.cs" />
- <Compile Include="Mono.Linker.Steps\MarkStep.cs" />
- <Compile Include="Mono.Linker.Steps\OutputStep.cs" />
- <Compile Include="Mono.Linker.Steps\ResolveFromXApiStep.cs" />
- <Compile Include="Mono.Linker.Steps\ResolveFromAssemblyStep.cs" />
- <Compile Include="Mono.Linker.Steps\ResolveFromXmlStep.cs" />
- <Compile Include="Mono.Linker.Steps\ResolveStep.cs" />
- <Compile Include="Mono.Linker.Steps\SweepStep.cs" />
- <Compile Include="Mono.Linker\Annotations.cs" />
- <Compile Include="Mono.Linker\AssemblyAction.cs" />
- <Compile Include="Mono.Linker\AssemblyInfo.cs" />
- <Compile Include="Mono.Linker\AssemblyResolver.cs" />
- <Compile Include="Mono.Linker\Driver.cs" />
- <Compile Include="Mono.Linker\LinkContext.cs" />
- <Compile Include="Mono.Linker\MethodAction.cs" />
- <Compile Include="Mono.Linker\Pipeline.cs" />
- <Compile Include="Mono.Linker\TypePreserve.cs" />
- <Compile Include="Mono.Linker\XApiReader.cs" />
- <Compile Include="Mono.Linker.Steps\TypeMapStep.cs" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Descriptors\mscorlib.xml">
- <LogicalName>mscorlib.xml</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="Descriptors\System.Web.xml">
- <LogicalName>System.web.xml</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="Descriptors\System.xml">
- <LogicalName>System.xml</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="Descriptors\Mono.Posix.xml">
- <LogicalName>Mono.Posix.xml</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="Descriptors\System.Drawing.xml">
- <LogicalName>System.Drawing.xml</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="Descriptors\System.Core.xml">
- <LogicalName>System.Core.xml</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <None Include="Makefile" />
- <None Include="README" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\external\cecil\Mono.Cecil.csproj">
- <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
- <Name>Mono.Cecil</Name>
- </ProjectReference>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-//
-// Annotations.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Compression;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker {
-
- public class AnnotationStore {
-
- readonly Dictionary<AssemblyDefinition, AssemblyAction> assembly_actions = new Dictionary<AssemblyDefinition, AssemblyAction> ();
- readonly Dictionary<MethodDefinition, MethodAction> method_actions = new Dictionary<MethodDefinition, MethodAction> ();
- readonly HashSet<IMetadataTokenProvider> marked = new HashSet<IMetadataTokenProvider> ();
- readonly HashSet<IMetadataTokenProvider> processed = new HashSet<IMetadataTokenProvider> ();
- readonly Dictionary<TypeDefinition, TypePreserve> preserved_types = new Dictionary<TypeDefinition, TypePreserve> ();
- readonly Dictionary<IMemberDefinition, List<MethodDefinition>> preserved_methods = new Dictionary<IMemberDefinition, List<MethodDefinition>> ();
- readonly HashSet<IMetadataTokenProvider> public_api = new HashSet<IMetadataTokenProvider> ();
- readonly Dictionary<MethodDefinition, List<MethodDefinition>> override_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
- readonly Dictionary<MethodDefinition, List<MethodDefinition>> base_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
- readonly Dictionary<AssemblyDefinition, ISymbolReader> symbol_readers = new Dictionary<AssemblyDefinition, ISymbolReader> ();
-
- readonly Dictionary<object, Dictionary<IMetadataTokenProvider, object>> custom_annotations = new Dictionary<object, Dictionary<IMetadataTokenProvider, object>> ();
-
- Stack<object> dependency_stack;
- System.Xml.XmlWriter writer;
- GZipStream zipStream;
-
- public void PrepareDependenciesDump ()
- {
- PrepareDependenciesDump ("linker-dependencies.xml.gz");
- }
-
- public void PrepareDependenciesDump (string filename)
- {
- dependency_stack = new Stack<object> ();
- System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
- settings.Indent = true;
- settings.IndentChars = "\t";
- var depsFile = File.OpenWrite (filename);
- zipStream = new GZipStream (depsFile, CompressionMode.Compress);
-
- writer = System.Xml.XmlWriter.Create (zipStream, settings);
- writer.WriteStartDocument ();
- writer.WriteStartElement ("dependencies");
- writer.WriteStartAttribute ("version");
- writer.WriteString ("1.0");
- writer.WriteEndAttribute ();
- }
-
- public AssemblyAction GetAction (AssemblyDefinition assembly)
- {
- AssemblyAction action;
- if (assembly_actions.TryGetValue (assembly, out action))
- return action;
-
- throw new NotSupportedException ();
- }
-
- public MethodAction GetAction (MethodDefinition method)
- {
- MethodAction action;
- if (method_actions.TryGetValue (method, out action))
- return action;
-
- return MethodAction.Nothing;
- }
-
- public void SetAction (AssemblyDefinition assembly, AssemblyAction action)
- {
- assembly_actions [assembly] = action;
- }
-
- public bool HasAction (AssemblyDefinition assembly)
- {
- return assembly_actions.ContainsKey (assembly);
- }
-
- public void SetAction (MethodDefinition method, MethodAction action)
- {
- method_actions [method] = action;
- }
-
- public void Mark (IMetadataTokenProvider provider)
- {
- marked.Add (provider);
- AddDependency (provider);
- }
-
- public bool IsMarked (IMetadataTokenProvider provider)
- {
- return marked.Contains (provider);
- }
-
- public void Processed (IMetadataTokenProvider provider)
- {
- processed.Add (provider);
- }
-
- public bool IsProcessed (IMetadataTokenProvider provider)
- {
- return processed.Contains (provider);
- }
-
- public bool IsPreserved (TypeDefinition type)
- {
- return preserved_types.ContainsKey (type);
- }
-
- public void SetPreserve (TypeDefinition type, TypePreserve preserve)
- {
- preserved_types [type] = preserve;
- }
-
- public TypePreserve GetPreserve (TypeDefinition type)
- {
- TypePreserve preserve;
- if (preserved_types.TryGetValue (type, out preserve))
- return preserve;
-
- throw new NotSupportedException ();
- }
-
- public void SetPublic (IMetadataTokenProvider provider)
- {
- public_api.Add (provider);
- }
-
- public bool IsPublic (IMetadataTokenProvider provider)
- {
- return public_api.Contains (provider);
- }
-
- public void AddOverride (MethodDefinition @base, MethodDefinition @override)
- {
- var methods = GetOverrides (@base);
- if (methods == null) {
- methods = new List<MethodDefinition> ();
- override_methods [@base] = methods;
- }
-
- methods.Add (@override);
- }
-
- public List<MethodDefinition> GetOverrides (MethodDefinition method)
- {
- List<MethodDefinition> overrides;
- if (override_methods.TryGetValue (method, out overrides))
- return overrides;
-
- return null;
- }
-
- public void AddBaseMethod (MethodDefinition method, MethodDefinition @base)
- {
- var methods = GetBaseMethods (method);
- if (methods == null) {
- methods = new List<MethodDefinition> ();
- base_methods [method] = methods;
- }
-
- methods.Add (@base);
- }
-
- public List<MethodDefinition> GetBaseMethods (MethodDefinition method)
- {
- List<MethodDefinition> bases;
- if (base_methods.TryGetValue (method, out bases))
- return bases;
-
- return null;
- }
-
- public List<MethodDefinition> GetPreservedMethods (TypeDefinition type)
- {
- return GetPreservedMethods (type as IMemberDefinition);
- }
-
- public void AddPreservedMethod (TypeDefinition type, MethodDefinition method)
- {
- AddPreservedMethod (type as IMemberDefinition, method);
- }
-
- public List<MethodDefinition> GetPreservedMethods (MethodDefinition method)
- {
- return GetPreservedMethods (method as IMemberDefinition);
- }
-
- public void AddPreservedMethod (MethodDefinition key, MethodDefinition method)
- {
- AddPreservedMethod (key as IMemberDefinition, method);
- }
-
- List<MethodDefinition> GetPreservedMethods (IMemberDefinition definition)
- {
- List<MethodDefinition> preserved;
- if (preserved_methods.TryGetValue (definition, out preserved))
- return preserved;
-
- return null;
- }
-
- void AddPreservedMethod (IMemberDefinition definition, MethodDefinition method)
- {
- var methods = GetPreservedMethods (definition);
- if (methods == null) {
- methods = new List<MethodDefinition> ();
- preserved_methods [definition] = methods;
- }
-
- methods.Add (method);
- }
-
- public void AddSymbolReader (AssemblyDefinition assembly, ISymbolReader symbolReader)
- {
- symbol_readers [assembly] = symbolReader;
- }
-
- public void CloseSymbolReader (AssemblyDefinition assembly)
- {
- ISymbolReader symbolReader;
- if (!symbol_readers.TryGetValue (assembly, out symbolReader))
- return;
-
- symbol_readers.Remove (assembly);
- symbolReader.Dispose ();
- }
-
- public Dictionary<IMetadataTokenProvider, object> GetCustomAnnotations (object key)
- {
- Dictionary<IMetadataTokenProvider, object> slots;
- if (custom_annotations.TryGetValue (key, out slots))
- return slots;
-
- slots = new Dictionary<IMetadataTokenProvider, object> ();
- custom_annotations.Add (key, slots);
- return slots;
- }
-
- public void AddDependency (object o)
- {
- if (writer == null)
- return;
-
- KeyValuePair<object, object> pair = new KeyValuePair<object, object> (dependency_stack.Count > 0 ? dependency_stack.Peek () : null, o);
- writer.WriteStartElement ("edge");
- writer.WriteAttributeString ("b", TokenString (pair.Key));
- writer.WriteAttributeString ("e", TokenString (pair.Value));
- writer.WriteEndElement ();
- }
-
- public void Push (object o)
- {
- if (writer == null)
- return;
-
- if (dependency_stack.Count > 0)
- AddDependency (o);
- dependency_stack.Push (o);
- }
-
- public void Pop ()
- {
- if (writer == null)
- return;
-
- dependency_stack.Pop ();
- }
-
- string TokenString (object o)
- {
- if (o == null)
- return "N:null";
-
- if (o is IMetadataTokenProvider)
- return (o as IMetadataTokenProvider).MetadataToken.TokenType + ":" + o;
-
- return "Other:" + o;
- }
-
- public void SaveDependencies ()
- {
- if (writer == null)
- return;
-
- writer.WriteEndElement ();
- writer.WriteEndDocument ();
- writer.Flush ();
- writer.Close ();
- zipStream.Close ();
-
- writer.Dispose ();
- zipStream.Dispose ();
- writer = null;
- zipStream = null;
- dependency_stack = null;
- }
- }
-}
+++ /dev/null
-//
-// AssemblyAction.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Linker {
-
- public enum AssemblyAction {
- // Ignore the assembly
- Skip,
- // Copy the existing files, assembly and symbols, into the output destination. E.g. .dll and .mdb
- // The linker still analyze the assemblies (to know what they require) but does not modify them
- Copy,
- // Link the assembly
- Link,
- // Remove the assembly from the output
- Delete,
- // Save the assembly/symbols in memory without linking it.
- // E.g. useful to remove unneeded assembly references (as done in SweepStep),
- // resolving [TypeForwardedTo] attributes (like PCL) to their final location
- Save
- }
-}
+++ /dev/null
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle ("Mono.Linker")]
-[assembly: AssemblyDescription ("Mono CIL Linker")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("(C) 2006, Jb Evain")]
-[assembly: AssemblyCulture ("")]
-
-[assembly: CLSCompliant (false)]
-[assembly: ComVisible (false)]
-
-[assembly: AssemblyVersion ("0.2.0.0")]
+++ /dev/null
-//
-// AssemblyResolver.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
- public class AssemblyResolver : BaseAssemblyResolver {
-
- IDictionary _assemblies;
-
- public IDictionary AssemblyCache {
- get { return _assemblies; }
- }
-
- public AssemblyResolver ()
- : this (new Hashtable ())
- {
- }
-
- public AssemblyResolver (IDictionary assembly_cache)
- {
- _assemblies = assembly_cache;
- }
-
- public override AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters)
- {
- AssemblyDefinition asm = (AssemblyDefinition) _assemblies [name.Name];
- if (asm == null) {
- asm = base.Resolve (name, parameters);
- _assemblies [name.Name] = asm;
- }
-
- return asm;
- }
-
- public void CacheAssembly (AssemblyDefinition assembly)
- {
- _assemblies [assembly.Name.Name] = assembly;
- base.AddSearchDirectory (Path.GetDirectoryName (assembly.MainModule.FileName));
- }
- }
-}
+++ /dev/null
-//
-// Driver.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-using SR = System.Reflection;
-using System.Xml.XPath;
-
-using Mono.Linker.Steps;
-
-namespace Mono.Linker {
-
- public class Driver {
-
- static readonly string _linker = "Mono CIL Linker";
-
- public static int Main (string [] args)
- {
- if (args.Length == 0)
- Usage ("No parameters specified");
-
- try {
-
- Driver driver = new Driver (args);
- driver.Run ();
-
- } catch (Exception e) {
- Console.WriteLine ("Fatal error in {0}", _linker);
- Console.WriteLine (e);
- return 1;
- }
-
- return 0;
- }
-
- Queue _queue;
-
- public Driver (string [] args)
- {
- _queue = new Queue (args);
- }
-
- bool HaveMoreTokens ()
- {
- return _queue.Count > 0;
- }
-
- void Run ()
- {
- Pipeline p = GetStandardPipeline ();
- LinkContext context = GetDefaultContext (p);
- I18nAssemblies assemblies = I18nAssemblies.All;
- ArrayList custom_steps = new ArrayList ();
-
- bool resolver = false;
- while (HaveMoreTokens ()) {
- string token = GetParam ();
- if (token.Length < 2)
- Usage ("Option is too short");
-
- if (! (token [0] == '-' || token [1] == '/'))
- Usage ("Expecting an option, got instead: " + token);
-
- if (token [0] == '-' && token [1] == '-') {
-
- if (token.Length < 3)
- Usage ("Option is too short");
-
- switch (token [2]) {
- case 'v':
- Version ();
- break;
- case 'a':
- About ();
- break;
- default:
- Usage (null);
- break;
- }
- }
-
- switch (token [1]) {
- case 'd': {
- DirectoryInfo info = new DirectoryInfo (GetParam ());
- context.Resolver.AddSearchDirectory (info.FullName);
- break;
- }
- case 'o':
- context.OutputDirectory = GetParam ();
- break;
- case 'c':
- context.CoreAction = ParseAssemblyAction (GetParam ());
- break;
- case 'p':
- AssemblyAction action = ParseAssemblyAction (GetParam ());
- context.Actions [GetParam ()] = action;
- break;
- case 's':
- custom_steps.Add (GetParam ());
- break;
- case 'x':
- foreach (string file in GetFiles (GetParam ()))
- p.PrependStep (new ResolveFromXmlStep (new XPathDocument (file)));
- resolver = true;
- break;
- case 'a':
- foreach (string file in GetFiles (GetParam ()))
- p.PrependStep (new ResolveFromAssemblyStep (file));
- resolver = true;
- break;
- case 'i':
- foreach (string file in GetFiles (GetParam ()))
- p.PrependStep (new ResolveFromXApiStep (new XPathDocument (file)));
- resolver = true;
- break;
- case 'l':
- assemblies = ParseI18n (GetParam ());
- break;
- case 'm':
- context.SetParameter (GetParam (), GetParam ());
- break;
- case 'b':
- context.LinkSymbols = bool.Parse (GetParam ());
- break;
- case 'g':
- if (!bool.Parse (GetParam ()))
- p.RemoveStep (typeof (RegenerateGuidStep));
- break;
- default:
- Usage ("Unknown option: `" + token [1] + "'");
- break;
- }
- }
-
- if (!resolver)
- Usage ("No resolver was created (use -x, -a or -i)");
-
- foreach (string custom_step in custom_steps)
- AddCustomStep (p, custom_step);
-
- p.AddStepAfter (typeof (LoadReferencesStep), new LoadI18nAssemblies (assemblies));
-
- p.Process (context);
- }
-
- static void AddCustomStep (Pipeline pipeline, string arg)
- {
- int pos = arg.IndexOf (":");
- if (pos == -1) {
- pipeline.AppendStep (ResolveStep (arg));
- return;
- }
-
- string [] parts = arg.Split (':');
- if (parts.Length != 2)
- Usage ("Step is specified as TYPE:STEP");
-
- if (parts [0].IndexOf (",") > -1)
- pipeline.AddStepBefore (FindStep (pipeline, parts [1]), ResolveStep (parts [0]));
- else if (parts [1].IndexOf (",") > -1)
- pipeline.AddStepAfter (FindStep (pipeline, parts [0]), ResolveStep (parts [1]));
- else
- Usage ("No comma separator in TYPE or STEP");
- }
-
- static Type FindStep (Pipeline pipeline, string name)
- {
- foreach (IStep step in pipeline.GetSteps ()) {
- Type t = step.GetType ();
- if (t.Name == name)
- return t;
- }
-
- return null;
- }
-
- static IStep ResolveStep (string type)
- {
- Type step = Type.GetType (type, false);
- if (step == null)
- Usage (String.Format ("Step type '{0}' not found.", type));
- if (!typeof (IStep).IsAssignableFrom (step))
- Usage (String.Format ("Step type '{0}' does not implement IStep interface.", type));
- return (IStep) Activator.CreateInstance (step);
- }
-
- static string [] GetFiles (string param)
- {
- if (param.Length < 1 || param [0] != '@')
- return new string [] {param};
-
- string file = param.Substring (1);
- return ReadLines (file);
- }
-
- static string [] ReadLines (string file)
- {
- ArrayList lines = new ArrayList ();
- using (StreamReader reader = new StreamReader (file)) {
- string line;
- while ((line = reader.ReadLine ()) != null)
- lines.Add (line);
- }
- return (string []) lines.ToArray (typeof (string));
- }
-
- static I18nAssemblies ParseI18n (string str)
- {
- I18nAssemblies assemblies = I18nAssemblies.None;
- string [] parts = str.Split (',');
- foreach (string part in parts)
- assemblies |= (I18nAssemblies) Enum.Parse (typeof (I18nAssemblies), part.Trim (), true);
-
- return assemblies;
- }
-
- static AssemblyAction ParseAssemblyAction (string s)
- {
- return (AssemblyAction) Enum.Parse (typeof (AssemblyAction), s, true);
- }
-
- string GetParam ()
- {
- if (_queue.Count == 0)
- Usage ("Expecting a parameter");
-
- return (string) _queue.Dequeue ();
- }
-
- static LinkContext GetDefaultContext (Pipeline pipeline)
- {
- LinkContext context = new LinkContext (pipeline);
- context.CoreAction = AssemblyAction.Skip;
- context.OutputDirectory = "output";
- return context;
- }
-
- static void Usage (string msg)
- {
- Console.WriteLine (_linker);
- if (msg != null)
- Console.WriteLine ("Error: " + msg);
- Console.WriteLine ("monolinker [options] -x|-a|-i file");
-
- Console.WriteLine (" --about About the {0}", _linker);
- Console.WriteLine (" --version Print the version number of the {0}", _linker);
- Console.WriteLine (" -out Specify the output directory, default to `output'");
- Console.WriteLine (" -c Action on the core assemblies, skip, copy or link, default to skip");
- Console.WriteLine (" -p Action per assembly");
- Console.WriteLine (" -s Add a new step to the pipeline.");
- Console.WriteLine (" -d Add a directory where the linker will look for assemblies");
- Console.WriteLine (" -b Generate debug symbols for each linked module (true or false)");
- Console.WriteLine (" -g Generate a new unique guid for each linked module (true or false)");
- Console.WriteLine (" -l List of i18n assemblies to copy to the output directory");
- Console.WriteLine (" separated with a comma: none,all,cjk,mideast,other,rare,west");
- Console.WriteLine (" default is all");
- Console.WriteLine (" -x Link from an XML descriptor");
- Console.WriteLine (" -a Link from a list of assemblies");
- Console.WriteLine (" -i Link from an mono-api-info descriptor");
- Console.WriteLine ("");
-
- Environment.Exit (1);
- }
-
- static void Version ()
- {
- Console.WriteLine ("{0} Version {1}",
- _linker,
- System.Reflection.Assembly.GetExecutingAssembly ().GetName ().Version);
-
- Environment.Exit(1);
- }
-
- static void About ()
- {
- Console.WriteLine ("For more information, visit the project Web site");
- Console.WriteLine (" http://www.mono-project.com/");
-
- Environment.Exit(1);
- }
-
- static Pipeline GetStandardPipeline ()
- {
- Pipeline p = new Pipeline ();
- p.AppendStep (new LoadReferencesStep ());
- p.AppendStep (new BlacklistStep ());
- p.AppendStep (new TypeMapStep ());
- p.AppendStep (new MarkStep ());
- p.AppendStep (new SweepStep ());
- p.AppendStep (new CleanStep ());
- p.AppendStep (new RegenerateGuidStep ());
- p.AppendStep (new OutputStep ());
- return p;
- }
- }
-}
+++ /dev/null
-//
-// I18nAssemblies.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Mono.Linker {
-
- [Flags]
- public enum I18nAssemblies {
-
- None = 0,
-
- CJK = 1,
- MidEast = 2,
- Other = 4,
- Rare = 8,
- West = 16,
-
- All = CJK | MidEast | Other | Rare | West,
- Base
- }
-}
+++ /dev/null
-//
-// XApiVisitor.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
- public interface IXApiVisitor {
-
- void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly);
- void OnAttribute (XPathNavigator nav);
- void OnClass (XPathNavigator nav, TypeDefinition type);
- void OnInterface (XPathNavigator nav, TypeDefinition type);
- void OnField (XPathNavigator nav, FieldDefinition field);
- void OnMethod (XPathNavigator nav, MethodDefinition method);
- void OnConstructor (XPathNavigator nav, MethodDefinition method);
- void OnProperty (XPathNavigator nav, PropertyDefinition property);
- void OnEvent (XPathNavigator nav, EventDefinition evt);
- }
-}
+++ /dev/null
-//
-// LinkContext.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker {
-
- public class LinkContext {
-
- Pipeline _pipeline;
- AssemblyAction _coreAction;
- Hashtable _actions;
- string _outputDirectory;
- Hashtable _parameters;
- bool _linkSymbols;
-
- AssemblyResolver _resolver;
-
- ReaderParameters _readerParameters;
- ISymbolReaderProvider _symbolReaderProvider;
- ISymbolWriterProvider _symbolWriterProvider;
-
- AnnotationStore _annotations;
-
- public Pipeline Pipeline {
- get { return _pipeline; }
- }
-
- public AnnotationStore Annotations {
- get { return _annotations; }
- }
-
- public string OutputDirectory {
- get { return _outputDirectory; }
- set { _outputDirectory = value; }
- }
-
- public AssemblyAction CoreAction {
- get { return _coreAction; }
- set { _coreAction = value; }
- }
-
- public bool LinkSymbols {
- get { return _linkSymbols; }
- set { _linkSymbols = value; }
- }
-
- public IDictionary Actions {
- get { return _actions; }
- }
-
- public AssemblyResolver Resolver {
- get { return _resolver; }
- }
-
- public ISymbolReaderProvider SymbolReaderProvider {
- get { return _symbolReaderProvider; }
- set { _symbolReaderProvider = value; }
- }
-
- public ISymbolWriterProvider SymbolWriterProvider {
- get { return _symbolWriterProvider; }
- set { _symbolWriterProvider = value; }
- }
-
- public bool LogInternalExceptions { get; set; } = false;
-
- public LinkContext (Pipeline pipeline)
- : this (pipeline, new AssemblyResolver ())
- {
- }
-
- public LinkContext (Pipeline pipeline, AssemblyResolver resolver)
- {
- _pipeline = pipeline;
- _resolver = resolver;
- _actions = new Hashtable ();
- _parameters = new Hashtable ();
- _annotations = new AnnotationStore ();
- _readerParameters = new ReaderParameters {
- AssemblyResolver = _resolver,
- };
- }
-
- public TypeDefinition GetType (string fullName)
- {
- int pos = fullName.IndexOf (",");
- fullName = fullName.Replace ("+", "/");
- if (pos == -1) {
- foreach (AssemblyDefinition asm in GetAssemblies ()) {
- var type = asm.MainModule.GetType (fullName);
- if (type != null)
- return type;
- }
-
- return null;
- }
-
- string asmname = fullName.Substring (pos + 1);
- fullName = fullName.Substring (0, pos);
- AssemblyDefinition assembly = Resolve (AssemblyNameReference.Parse (asmname));
- return assembly.MainModule.GetType (fullName);
- }
-
- public AssemblyDefinition Resolve (string name)
- {
- if (File.Exists (name)) {
- AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (name, _readerParameters);
- _resolver.CacheAssembly (assembly);
- return assembly;
- }
-
- return Resolve (new AssemblyNameReference (name, new Version ()));
- }
-
- public AssemblyDefinition Resolve (IMetadataScope scope)
- {
- AssemblyNameReference reference = GetReference (scope);
- try {
- AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
-
- if (SeenFirstTime (assembly)) {
- SafeReadSymbols (assembly);
- SetAction (assembly);
- }
-
- return assembly;
- }
- catch {
- throw new AssemblyResolutionException (reference);
- }
- }
-
- bool SeenFirstTime (AssemblyDefinition assembly)
- {
- return !_annotations.HasAction (assembly);
- }
-
- public void SafeReadSymbols (AssemblyDefinition assembly)
- {
- if (!_linkSymbols)
- return;
-
- if (assembly.MainModule.HasSymbols)
- return;
-
- try {
- if (_symbolReaderProvider != null) {
- var symbolReader = _symbolReaderProvider.GetSymbolReader (
- assembly.MainModule,
- assembly.MainModule.FileName);
-
- _annotations.AddSymbolReader (assembly, symbolReader);
- assembly.MainModule.ReadSymbols (symbolReader);
- } else
- assembly.MainModule.ReadSymbols ();
- } catch {}
- }
-
- static AssemblyNameReference GetReference (IMetadataScope scope)
- {
- AssemblyNameReference reference;
- if (scope is ModuleDefinition) {
- AssemblyDefinition asm = ((ModuleDefinition) scope).Assembly;
- reference = asm.Name;
- } else
- reference = (AssemblyNameReference) scope;
-
- return reference;
- }
-
- void SetAction (AssemblyDefinition assembly)
- {
- AssemblyAction action = AssemblyAction.Link;
-
- AssemblyNameDefinition name = assembly.Name;
-
- if (_actions.Contains (name.Name))
- action = (AssemblyAction) _actions [name.Name];
- else if (IsCore (name))
- action = _coreAction;
-
- _annotations.SetAction (assembly, action);
- }
-
- static bool IsCore (AssemblyNameReference name)
- {
- switch (name.Name) {
- case "mscorlib":
- case "Accessibility":
- case "Mono.Security":
- // WPF
- case "PresentationFramework":
- case "PresentationCore":
- case "WindowsBase":
- case "UIAutomationProvider":
- case "UIAutomationTypes":
- case "PresentationUI":
- case "ReachFramework":
- return true;
- default:
- return name.Name.StartsWith ("System")
- || name.Name.StartsWith ("Microsoft");
- }
- }
-
- public AssemblyDefinition [] GetAssemblies ()
- {
- IDictionary cache = _resolver.AssemblyCache;
- AssemblyDefinition [] asms = new AssemblyDefinition [cache.Count];
- cache.Values.CopyTo (asms, 0);
- return asms;
- }
-
- public void SetParameter (string key, string value)
- {
- _parameters [key] = value;
- }
-
- public bool HasParameter (string key)
- {
- return _parameters.Contains (key);
- }
-
- public string GetParameter (string key)
- {
- return (string) _parameters [key];
- }
- }
-}
+++ /dev/null
-//
-// MethodAction.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Linker {
-
- public enum MethodAction {
- Nothing,
- Parse,
- ForceParse
- }
-}
+++ /dev/null
-//
-// Pipeline.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Diagnostics;
-
-using Mono.Linker.Steps;
-
-namespace Mono.Linker {
-
- public class Pipeline {
-
- ArrayList _steps;
-
- public Pipeline ()
- {
- _steps = new ArrayList();
- }
-
- public void PrependStep (IStep step)
- {
- _steps.Insert (0, step);
- }
-
- public void AppendStep (IStep step)
- {
- _steps.Add (step);
- }
-
- public void AddStepBefore (Type target, IStep step)
- {
- for (int i = 0; i < _steps.Count; i++) {
- if (target.IsInstanceOfType (_steps [i])) {
- _steps.Insert (i, step);
- return;
- }
- }
- string msg = String.Format ("Step {0} could not be inserted before (not found) {1}", step, target);
- throw new InvalidOperationException (msg);
- }
-
- public void ReplaceStep (Type target, IStep step)
- {
- AddStepBefore (target, step);
- RemoveStep (target);
- }
-
- public void AddStepAfter (Type target, IStep step)
- {
- for (int i = 0; i < _steps.Count; i++) {
- if (target.IsInstanceOfType (_steps [i])) {
- if (i == _steps.Count - 1)
- _steps.Add (step);
- else
- _steps.Insert (i + 1, step);
- return;
- }
- }
- string msg = String.Format ("Step {0} could not be inserted after (not found) {1}", step, target);
- throw new InvalidOperationException (msg);
- }
-
- public void AddStepAfter (IStep target, IStep step)
- {
- for (int i = 0; i < _steps.Count; i++) {
- if (_steps [i] == target) {
- if (i == _steps.Count - 1)
- _steps.Add (step);
- else
- _steps.Insert (i + 1, step);
- return;
- }
- }
- }
-
- public void RemoveStep (Type target)
- {
- for (int i = 0; i < _steps.Count; i++) {
- if (_steps [i].GetType () != target)
- continue;
-
- _steps.RemoveAt (i);
- break;
- }
- }
-
- public void Process (LinkContext context)
- {
- while (_steps.Count > 0) {
- IStep step = (IStep) _steps [0];
- context.Annotations.Push (step);
- step.Process (context);
- context.Annotations.Pop ();
- _steps.Remove (step);
- }
- }
-
- public IStep [] GetSteps ()
- {
- return (IStep []) _steps.ToArray (typeof (IStep));
- }
-
- public bool ContainsStep (Type type)
- {
- foreach (IStep step in _steps)
- if (step.GetType () == type)
- return true;
-
- return false;
- }
- }
-}
+++ /dev/null
-//
-// TypePreserve.cs
-//
-// Author:
-// Jb Evain (jb@nurv.fr)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace Mono.Linker {
-
- public enum TypePreserve {
- Nothing,
- All,
- Fields,
- Methods,
- }
-}
+++ /dev/null
-//
-// XApiReader.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Linq;
-using System.Text;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
- public class XApiReader {
-
- static readonly string _name = "name";
- static readonly string _ns = string.Empty;
-
- LinkContext _context;
- XPathDocument _document;
- IXApiVisitor _visitor;
-
- AssemblyDefinition _assembly;
- string _namespace;
- Stack _types = new Stack ();
- StringBuilder _signature;
-
- public XApiReader (XPathDocument document, IXApiVisitor visitor)
- {
- _document = document;
- _visitor = visitor;
- }
-
- public void Process (LinkContext context)
- {
- _context = context;
- ProcessAssemblies (_document.CreateNavigator ());
- }
-
- void OnAssembly (XPathNavigator nav)
- {
- _assembly = GetAssembly (nav);
-
- _visitor.OnAssembly (nav, _assembly);
-
- ProcessAttributes (nav);
- ProcessNamespaces (nav);
- }
-
- AssemblyDefinition GetAssembly (XPathNavigator nav)
- {
- AssemblyNameReference name = new AssemblyNameReference (
- GetName (nav),
- new Version (GetAttribute (nav, "version")));
-
- AssemblyDefinition assembly = _context.Resolve (name);
- ProcessReferences (assembly);
- return assembly;
- }
-
- void ProcessReferences (AssemblyDefinition assembly)
- {
- foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
- _context.Resolve (name);
- }
-
- void OnAttribute (XPathNavigator nav)
- {
- _visitor.OnAttribute (nav);
- }
-
- void PushType (TypeDefinition type)
- {
- _types.Push (type);
- }
-
- TypeDefinition PeekType ()
- {
- return (TypeDefinition) _types.Peek ();
- }
-
- TypeDefinition PopType ()
- {
- return (TypeDefinition) _types.Pop ();
- }
-
- void OnNamespace (XPathNavigator nav)
- {
- _namespace = GetName (nav);
-
- ProcessClasses (nav);
- }
-
- void OnClass (XPathNavigator nav)
- {
- string name = GetClassName (nav);
-
- TypeDefinition type = _assembly.MainModule.GetType (name);
- if (type == null)
- return;
-
- _visitor.OnClass (nav, type);
-
- PushType (type);
-
- ProcessAttributes (nav);
- ProcessInterfaces (nav);
- ProcessFields (nav);
- ProcessMethods (nav);
- ProcessConstructors (nav);
- ProcessProperties (nav);
- ProcessEvents (nav);
- ProcessClasses (nav);
-
- PopType ();
- }
-
- string GetClassName (XPathNavigator nav)
- {
- if (IsNestedClass ())
- return PeekType ().FullName + "/" + GetName (nav);
-
- return _namespace + "." + GetName (nav);
- }
-
- bool IsNestedClass ()
- {
- return _types.Count > 0;
- }
-
- void OnField (XPathNavigator nav)
- {
- TypeDefinition declaring = PeekType ();
-
- FieldDefinition field = declaring.Fields.FirstOrDefault (f => f.Name == GetName (nav));
- if (field != null)
- _visitor.OnField (nav, field);
-
- ProcessAttributes (nav);
- }
-
- void OnInterface (XPathNavigator nav)
- {
- string name = GetName (nav);
-
- TypeDefinition type = _context.GetType (GetTypeName (name));
- if (type != null)
- _visitor.OnInterface (nav, type);
- }
-
- void OnMethod (XPathNavigator nav)
- {
- InitMethodSignature (nav);
-
- ProcessParameters (nav);
-
- string signature = GetMethodSignature ();
-
- MethodDefinition method = GetMethod (signature);
- if (method != null)
- _visitor.OnMethod (nav, method);
-
- ProcessAttributes (nav);
- }
-
- MethodDefinition GetMethod (string signature)
- {
- return GetMethod (PeekType ().Methods, signature);
- }
-
- static MethodDefinition GetMethod (ICollection methods, string signature)
- {
- foreach (MethodDefinition method in methods)
- if (signature == GetSignature (method))
- return method;
-
- return null;
- }
-
- static string GetSignature (MethodDefinition method)
- {
- return method.ToString ().Replace ("<", "[").Replace (">", "]");
- }
-
- string GetMethodSignature ()
- {
- _signature.Append (")");
- return _signature.ToString ();
- }
-
- void InitMethodSignature (XPathNavigator nav)
- {
- _signature = new StringBuilder ();
-
- string returntype = GetAttribute (nav, "returntype");
- if (returntype == null || returntype.Length == 0)
- returntype = "System.Void";
-
- _signature.Append (NormalizeTypeName (returntype));
- _signature.Append (" ");
- _signature.Append (PeekType ().FullName);
- _signature.Append ("::");
-
- string name = GetName (nav);
- _signature.Append (GetMethodName (name));
-
- _signature.Append ("(");
- }
-
- static string GetMethodName (string name)
- {
- return GetStringBefore (name, "(");
- }
-
- static string NormalizeTypeName (string name)
- {
- return name.Replace ("+", "/").Replace ("<", "[").Replace (">", "]");
- }
-
- static string GetTypeName (string name)
- {
- return GetStringBefore (NormalizeTypeName (name), "[");
- }
-
- static string GetStringBefore (string str, string marker)
- {
- int pos = str.IndexOf (marker);
- if (pos == -1)
- return str;
-
- return str.Substring (0, pos);
- }
-
- void OnParameter (XPathNavigator nav)
- {
- string type = GetAttribute (nav, "type");
- int pos = int.Parse (GetAttribute (nav, "position"));
-
- if (pos > 0)
- _signature.Append (",");
- _signature.Append (NormalizeTypeName (type));
- }
-
- void OnConstructor (XPathNavigator nav)
- {
- InitMethodSignature (nav);
-
- ProcessParameters (nav);
-
- string signature = GetMethodSignature ();
-
- MethodDefinition ctor = GetMethod (signature);
- if (ctor != null)
- _visitor.OnConstructor (nav, ctor);
-
- ProcessAttributes (nav);
- }
-
- void OnProperty (XPathNavigator nav)
- {
- string name = GetName (nav);
- TypeDefinition type = PeekType ();
-
- var property = type.Properties.FirstOrDefault (p => p.Name == name);
- if (property != null)
- _visitor.OnProperty (nav, property);
-
- ProcessAttributes (nav);
- ProcessMethods (nav);
- }
-
- void OnEvent (XPathNavigator nav)
- {
- string name = GetName (nav);
- TypeDefinition type = PeekType ();
-
- EventDefinition evt = type.Events.FirstOrDefault (e => e.Name == name);
- if (evt != null)
- _visitor.OnEvent (nav, evt);
-
- ProcessAttributes (nav);
- }
-
- void ProcessAssemblies (XPathNavigator nav)
- {
- ProcessChildren (nav, "assemblies//assembly", new OnChildren (OnAssembly));
- }
-
- void ProcessAttributes (XPathNavigator nav)
- {
- ProcessChildren (nav, "attributes//attribute", new OnChildren (OnAttribute));
- }
-
- void ProcessNamespaces (XPathNavigator nav)
- {
- ProcessChildren (nav, "namespaces//namespace", new OnChildren (OnNamespace));
- }
-
- void ProcessClasses (XPathNavigator nav)
- {
- ProcessChildren (nav, "classes//class", new OnChildren (OnClass));
- }
-
- void ProcessInterfaces (XPathNavigator nav)
- {
- ProcessChildren (nav, "intefaces//interface", new OnChildren (OnInterface));
- }
-
- void ProcessFields (XPathNavigator nav)
- {
- ProcessChildren (nav, "fields//field", new OnChildren (OnField));
- }
-
- void ProcessMethods (XPathNavigator nav)
- {
- ProcessChildren (nav, "methods//method", new OnChildren (OnMethod));
- }
-
- void ProcessConstructors (XPathNavigator nav)
- {
- ProcessChildren (nav, "constructors//constructor", new OnChildren (OnConstructor));
- }
-
- void ProcessParameters (XPathNavigator nav)
- {
- ProcessChildren (nav, "parameters//parameter", new OnChildren (OnParameter));
- }
-
- void ProcessProperties (XPathNavigator nav)
- {
- ProcessChildren (nav, "properties//property", new OnChildren (OnProperty));
- }
-
- void ProcessEvents (XPathNavigator nav)
- {
- ProcessChildren (nav, "events//event", new OnChildren (OnEvent));
- }
-
- static void ProcessChildren (XPathNavigator nav, string children, OnChildren action)
- {
- XPathNodeIterator iterator = nav.Select (children);
- while (iterator.MoveNext ())
- action (iterator.Current);
- }
-
- delegate void OnChildren (XPathNavigator nav);
-
- static string GetName (XPathNavigator nav)
- {
- return GetAttribute (nav, _name);
- }
-
- static string GetAttribute (XPathNavigator nav, string attribute)
- {
- return nav.GetAttribute (attribute, _ns);
- }
- }
-}
+++ /dev/null
-monolinker
-====
-
-monolinker is the Mono CIL Linker.
-
-The linker is a tool one can use to only ship the minimal possible set of
-functions that a set of programs might require to run as opposed to the full
-libraries.
-
-* How does the linker work?
-
-The linker analyses the intermediate code (CIL) produced by every compiler
-targeting the Mono platform like mcs, gmcs, vbnc, booc or others. It will walk
-through all the code that it is given to it, and basically, perform a mark and
-sweep operations on all the code that it is referenced, to only keep what is
-necessary for the source program to run.
-
-* Usage
-
-1) Linking from a source assembly
-
-The command:
-
-monolinker -a Program.exe
-
-will use the assembly Program.exe as a source. That means that the linker will
-walk through all the methods of Program.exe to generate only what is necessary
-for this assembly to run.
-
-2) Linking from an xml descriptor
-
-The command:
-
-monolinker -x desc.xml
-
-will use the XML descriptor as a source. That means that the linker will
-use this file to decide what to link in a set of assemblies. The format of the
-descriptors is described further on in this document.
-
-3) Linking from an api info file
-
-The command:
-
-monolinker -i assembly.info
-
-will use a file produced by mono-api-info as a source. The linker will use
-this file to link only what is necessary to match the public API defined in
-the info file.
-
-4) Actions on the assemblies
-
-You can specify what the linker should do exactly per assembly.
-
-The linker can do 3 things:
-
- - skip them, and do nothing with them,
- - copy them to the output directory,
- - link them, to reduce their size.
-
-You can specify an action per assembly like this:
-
-monolinker -p link Foo
-
-or
-
-monolinker -p skip System.Windows.Forms
-
-Or you can specify what to do for the core assemblies.
-
-Core assemblies are the assemblies that belongs to the base class library,
-like mscorlib.dll, System.dll or System.Windows.Forms.dll.
-
-You can specify what action to do on the core assemblies with the option:
-
--c skip|copy|link
-
-5) The output directory
-
-By default, the linker will create an `output' directory in the current
-directory where it will emit the linked files, to avoid erasing source
-assemblies. You can specify the output directory with the option:
-
--o output_directory
-
-If you specify the directory `.', please ensure that you won't write over
-important assemblies of yours.
-
-* Syntax of a xml descriptor
-
-Here is an example that shows all the possibilities of this format:
-
----
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- <type fullname="Bar" preserve="nothing" required="false" />
- <type fullname="Baz" preserve="fields" required="false" />
- <type fullname="Gazonk">
- <method signature="System.Void .ctor(System.String)" />
- <field signature="System.String _blah" />
- </type>
- </assembly>
-</linker>
----
-
-In this example, the linker will link the types Foo, Bar, Baz and Gazonk.
-
-The fullname attribute specifies the fullname of the type in the format
-specified by ECMA-335. This is in Mono and certain cases not the same
-as the one reported by Type.FullName (nested classes e.g.).
-
-The preserve attribute ensures that all the fields of the type Baz will be
-always be linked, not matter if they are used or not, but that neither the
-fields or the methods of Bar will be linked if they are not used. Not
-specifying a preserve attribute implies that we are preserving everything in
-the specified type.
-
-The required attribute specifies that if the type is not marked, during the
-mark operation, it will not be linked.
-
-The type Gazonk will be linked, as well as its constructor taking a string as a
-parameter, and it's _blah field.
-
-You can have multiple assembly nodes.
-
-6) The i18n Assemblies
-
-Mono have a few assemblies which contains everything region specific:
-
- I18N.CJK.dll
- I18N.MidEast.dll
- I18N.Other.dll
- I18N.Rare.dll
- I18N.West.dll
-
-By default, they will all be copied to the output directory. But you can
-specify which one you want using the command:
-
-monolinker -l choice
-
-Where choice can either be: none, all, cjk, mideast, other, rare or west. You can
-combine the values with a comma.
-
-Example:
-
-monolinker -a assembly -l mideast,cjk
-
-7) Specifying directories where the linker should look for assemblies
-
-By default, the linker will first look for assemblies in the directories `.'
-and `bin'. You can specify
-
-Example:
-
-monolinker -d ../../libs -a program.exe
-
-8) Adding custom steps to the linker.
-
-You can write custom steps for the linker and tell the linker to use them.
-Let's take a simple example:
-
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-namespace Foo {
-
- public class FooStep : IStep {
-
- public void Process (LinkContext context)
- {
- foreach (IStep step in context.Pipeline.GetSteps ()) {
- Console.WriteLine (step.GetType ().Name);
- }
- }
- }
-}
-
-
-That is compiled against the linker to a Foo.dll assembly.
-
-You can ask the linker to add it at the end of the pipeline:
-
-monolinker -s Foo.FooStep,Foo -a program.exe
-
-Or you can ask the linker to add it after a specific step:
-
-monolinker -s MarkStep:Foo.FooStep,Foo -a program.exe
-
-Or before a specific step:
-
-monolinker -s Foo.FooStep,Foo:MarkStep
-
-* Inside the linker
-
-The linker is a quite small piece of code, and it pretty simple to address.
-Its only dependency is Mono.Cecil, that is used to read, modify and write back
-the assemblies.
-
-Everything is located in the namespace Mono.Linker, or in sub namespaces.
-Being a command line utility, its entry point function is in the class Driver.
-
-This class is in charge of analyzing the command line, and to instantiate two
-important objects, a LinkContext, and a Pipeline.
-
-The LinkContext contains all the informations that will be used during the
-linking process, such as the assemblies involved, the output directory and
-probably other useful stuff.
-
-The Pipeline is simply a queue of actions (steps), to be applied to the current
-context. The whole process of linking is split into those differents steps
-that are all located in the Mono.Linker.Steps namespace.
-
-Here are the current steps that are implemented, in the order they are used:
-
-1) ResolveFromAssembly or ResolveFromXml
-
-Those steps are used to initialize the context, and pre-mark the root code
-that will be used as a source for the linker.
-
-Resolving from an assembly or resolving from a xml descriptor is a decision
-taken in the command line parsing.
-
-2) LoadReferences
-
-This step will load all the references of all the assemblies involved in the
-current context.
-
-3) Blacklist
-
-This step is used if and only if you have specified that the core should be
-linked. It will load a bunch of resources from the assemblies, that are
-actually a few XML descriptors, that will ensure that some types and methods
-that are used from inside the runtime are properly linked and not removed.
-
-It is doing so by inserting a ResolveFromXml step per blacklist in the
-pipeline.
-
-4) Mark
-
-This is the most complex step. The linker will get from the context the list
-of types, fields and methods that have been pre-marked in the resolve steps,
-and walk through all of them. For every method, it will analyse the CIL stream,
-to find references to other fields, types, or methods.
-
-When it encounters such a reference, it will resolve the original definition of
-this reference, and add this to the queue of items to be processed. For
-instance, if have in a source assembly a call to Console.WriteLine, the linker
-will resolve the appropriate method WriteLine in the Console type from the
-mscorlib assembly, and add it to the queue. When this WriteLine method will be
-dequeued, and processed, the linker will go through everything that is used in
-it, and add it to the queue, if they have not been processed already.
-
-To know if something have been marked to be linked, or processed, the linker
-is using a functionality of Cecil called annotations. Almost everything in
-Cecil can be annotated. Concretely, it means that almost everything own an
-Hashtable in which you can add what you want, using the keys and the values you
-want.
-
-So the linker will annotate assemblies, types, methods and fields to know
-what should be linked or not, and what have been processed, and how it should
-process them.
-
-This is really useful as we don't have to recreate a full hierarchy of classes
-to encapsulate the different Cecil types to add the few informations we want.
-
-5) Sweep
-
-This simple step will walk through all the elements of an assembly, and based
-on their annotations, remove them or keep them.
-
-6) Clean
-
-This step will clean parts of the assemblies, like properties. If a proprety
-used to have a getter and a setter, and that after the mark & sweep steps,
-only the getter is linked, it will update the property to reflect that.
-
-There is a few things to keep clean like properties has we've seen, events,
-nested classes, and probably a few others.
-
-7) Output
-
-For each assembly in the context, this step will act on the action associated
-to the assembly. If the assembly is marked as skip, it won't do anything,
-if it's marked as copy, it will copy the assembly to the output directory,
-and if it's link, it will save the modified assembly to the output directory.
-
-* Reporting a bug
-
-If you face a bug in the linker, please report it to:
-
-http://bugzilla.ximian.com
-
-Product: Mono tools, Component: linker.
-
-* Mailing lists
-
-You can ask questions about the linker of the cecil Google Group:
-
-http://groups.google.com/group/mono-cecil
-
---
-Jb Evain <jbevain@novell.com>
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<configuration>
- <!--
- Application settings for NUnit-console.exe. Do NOT put settings
- for use by your tests here.
- -->
- <appSettings>
-
- <!--
- Specify the location to be used by .NET for the cache
- -->
- <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
-
- </appSettings>
-
- <!--
- The startup section may be used to specify the runtime versions
- supported in the order that they will be used if more than one
- is present. As supplied, this section is commented out, which
- causes nunit-console to use the version of the framework with
- which it was built.
-
- Since .NET 1.0 does not recognize the <supportedRuntime> elements,
- a <requiredRuntime> element is used in case it is the only version
- of the framework that is installed.
- -->
- <!--
- <startup>
- <supportedRuntime version="v2.0.50727" />
- <supportedRuntime version="v2.0.50215" />
- <supportedRuntime version="v2.0.40607" />
- <supportedRuntime version="v1.1.4322" />
- <supportedRuntime version="v1.0.3705" />
-
- <requiredRuntime version="v1.0.3705" />
- </startup>
- -->
-
- <!--
- The following <runtime> section allows running nunit under
- .NET 1.0 by redirecting assemblies. The appliesTo attribute
- causes the section to be ignored except under .NET 1.0version 1
- on a machine with only the .NET version 1.0 runtime installed.
- If application and its tests were built for .NET 1.1 you will
- also need to redirect system assemblies in the test config file.
- -->
-
- <runtime>
-
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
- appliesTo="v1.0.3705">
-
- <dependentAssembly>
- <assemblyIdentity name="System"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Data"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Drawing"
- publicKeyToken="b03f5f7f11d50a3a"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Windows.Forms"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Xml"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- </assemblyBinding>
-
- </runtime>
-
-</configuration>
\ No newline at end of file
+++ /dev/null
-MCS = mcs
-
-all: Mono.Linker.Tests.dll
-
-Mono.Cecil.dll:
- cp ../Mono.Cecil.dll .
-
-monolinker.exe:
- cp ../monolinker.exe .
-
-Mono.Linker.Tests.dll.sources:
- find Mono.Linker.Tests -name "*.cs" > Mono.Linker.Tests.dll.sources
-
-Mono.Linker.Tests.dll: Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources
- $(MCS) /target:library /out:Mono.Linker.Tests.dll /r:nunitlite.dll /r:Mono.Cecil.dll /r:monolinker.exe @Mono.Linker.Tests.dll.sources
-
-clean:
- rm -rf Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources Mono.Linker.Tests.dll
-
-run-test: all
- nunit-console Mono.Linker.Tests.dll
+++ /dev/null
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Mono.Linker.Tests</RootNamespace>
- <AssemblyName>Mono.Linker.Tests</AssemblyName>
- <StartupObject>
- </StartupObject>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ItemGroup>
- <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>Libs\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\class\Mono.Cecil\Mono.Cecil.csproj">
- <Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>
- <Name>Mono.Cecil</Name>
- </ProjectReference>
- <ProjectReference Include="..\Mono.Linker.csproj">
- <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
- <Name>Mono.Linker</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Mono.Linker.Tests\AbstractLinkingTestFixture.cs" />
- <Compile Include="Mono.Linker.Tests\AbstractTestFixture.cs" />
- <Compile Include="Mono.Linker.Tests\AssemblyLinkingTestFixture.cs" />
- <Compile Include="Mono.Linker.Tests\AssemblyInfo.cs" />
- <Compile Include="Mono.Linker.Tests\IntegrationTestFixture.cs" />
- <Compile Include="Mono.Linker.Tests\XmlLinkingTestFixture.cs" />
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Properties\" />
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-//
-// AbstractLinkingTestFixture.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Cecil;
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
- public abstract class AbstractLinkingTestFixture : AbstractTestFixture {
-
- [SetUp]
- public override void SetUp ()
- {
- base.SetUp ();
-
- TestCasesRoot = "Linker";
- }
-
- [TearDown]
- public override void TearDown ()
- {
- base.TearDown ();
-
- string output = GetOutputPath ();
- if (Directory.Exists (output))
- Directory.Delete (output, true);
- }
-
- protected override Pipeline GetPipeline ()
- {
- Pipeline p = new Pipeline ();
- p.AppendStep (new LoadReferencesStep ());
- p.AppendStep (new BlacklistStep ());
- p.AppendStep (new TypeMapStep ());
- p.AppendStep (new MarkStep ());
- p.AppendStep (new SweepStep ());
- p.AppendStep (new CleanStep ());
- p.AppendStep (new OutputStep ());
- return p;
- }
-
- protected override void RunTest (string testCase)
- {
- base.RunTest (testCase);
-
- Prepare ();
- }
-
- void Prepare ()
- {
- Context = GetContext ();
- string output = GetOutputPath ();
- if (Directory.Exists (output))
- Directory.Delete (output, true);
- Directory.CreateDirectory (output);
- }
-
- protected override void Run ()
- {
- base.Run ();
- Compare ();
- }
-
- void Compare ()
- {
- foreach (AssemblyDefinition assembly in Context.GetAssemblies ()) {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- continue;
-
- string fileName = GetAssemblyFileName (assembly);
-
- CompareAssemblies (
- AssemblyFactory.GetAssembly (
- Path.Combine (GetTestCasePath (), fileName)),
- AssemblyFactory.GetAssembly (
- Path.Combine (GetOutputPath (), fileName)));
- }
- }
-
- static void CompareAssemblies (AssemblyDefinition original, AssemblyDefinition linked)
- {
- foreach (TypeDefinition originalType in original.MainModule.Types) {
- TypeDefinition linkedType = linked.MainModule.Types [originalType.FullName];
- if (NotLinked (originalType)) {
- Assert.IsNull (linkedType, string.Format ("Type `{0}' should not have been linked", originalType));
- continue;
- }
-
- Assert.IsNotNull (linkedType, string.Format ("Type `{0}' should have been linked", originalType));
- CompareTypes (originalType, linkedType);
- }
- }
-
- static void CompareTypes (TypeDefinition type, TypeDefinition linkedType)
- {
- foreach (FieldDefinition originalField in type.Fields) {
- FieldDefinition linkedField = linkedType.Fields.GetField (originalField.Name);// TODO: also get with the type!
- if (NotLinked (originalField)) {
- Assert.IsNull (linkedField, string.Format ("Field `{0}' should not have been linked", originalField));
- continue;
- }
-
- Assert.IsNotNull (linkedField, string.Format ("Field `{0}' should have been linked", originalField));
- }
-
- foreach (MethodDefinition originalCtor in type.Constructors) {
- MethodDefinition linkedCtor = linkedType.Constructors.GetConstructor (originalCtor.IsStatic, originalCtor.Parameters);
- if (NotLinked (originalCtor)) {
- Assert.IsNull (linkedCtor, string.Format ("Constructor `{0}' should not have been linked", originalCtor));
- continue;
- }
-
- Assert.IsNotNull (linkedCtor, string.Format ("Constructor `{0}' should have been linked", originalCtor));
- }
-
- foreach (MethodDefinition originalMethod in type.Methods) {
- MethodDefinition linkedMethod = linkedType.Methods.GetMethod (originalMethod.Name, originalMethod.Parameters);
- if (NotLinked (originalMethod)) {
- Assert.IsNull (linkedMethod, string.Format ("Method `{0}' should not have been linked", originalMethod));
- continue;
- }
-
- Assert.IsNotNull (linkedMethod, string.Format ("Method `{0}' should have been linked", originalMethod));
- }
- }
-
- static bool NotLinked(ICustomAttributeProvider provider)
- {
- foreach (CustomAttribute ca in provider.CustomAttributes)
- if (ca.Constructor.DeclaringType.Name == "NotLinkedAttribute")
- return true;
-
- return false;
- }
- }
-}
+++ /dev/null
-//
-// AbstractTestFixture.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Linker.Tests {
-
- using System;
- using System.IO;
-
- using Mono.Cecil;
-
- using NUnit.Framework;
-
- public abstract class AbstractTestFixture {
-
- string _testCasesRoot;
- string _testCase;
- LinkContext _context;
- Pipeline _pipeline;
-
- protected LinkContext Context {
- get { return _context; }
- set { _context = value; }
- }
-
- protected Pipeline Pipeline {
- get { return _pipeline; }
- set { _pipeline = value; }
- }
-
- public string TestCasesRoot {
- get { return _testCasesRoot; }
- set { _testCasesRoot = value; }
- }
-
- public string TestCase {
- get { return _testCase; }
- set { _testCase = value; }
- }
-
- [SetUp]
- public virtual void SetUp ()
- {
- _pipeline = GetPipeline ();
- }
-
- [TearDown]
- public virtual void TearDown ()
- {
- }
-
- protected virtual Pipeline GetPipeline ()
- {
- return new Pipeline ();
- }
-
- protected virtual LinkContext GetContext ()
- {
- LinkContext context = new LinkContext (_pipeline);
- context.OutputDirectory = GetOutputPath ();
- context.CoreAction = AssemblyAction.Copy;
- return context;
- }
-
- protected string GetOutputPath ()
- {
- return Path.Combine (
- Path.GetTempPath (),
- _testCase);
- }
-
- protected string GetTestCasePath ()
- {
- return Path.Combine (
- Path.Combine (
-#if DEBUG
- Path.Combine (Environment.CurrentDirectory,
- Path.Combine ("..", "..")),
-#else
- Environment.CurrentDirectory,
-#endif
- "TestCases"),
- Path.Combine (
- _testCasesRoot,
- _testCase));
- }
-
- protected virtual void RunTest (string testCase)
- {
- _testCase = testCase;
- _context = GetContext ();
- }
-
- protected virtual void Run ()
- {
- string cd = Environment.CurrentDirectory;
- Environment.CurrentDirectory = GetTestCasePath ();
- try {
- _pipeline.Process (_context);
- } finally {
- Environment.CurrentDirectory = cd;
- }
- }
-
- protected static string GetAssemblyFileName (AssemblyDefinition asm)
- {
- return asm.Name.Name + (asm.Kind == AssemblyKind.Dll ? ".dll" : ".exe");
- }
- }
-}
+++ /dev/null
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle ("Mono.Linker.Tests")]
-[assembly: AssemblyDescription ("NUnit tests for Mono's CIL Linker")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("(C) 2006, Jb Evain")]
-[assembly: AssemblyCulture ("")]
-
-[assembly: CLSCompliant (false)]
-[assembly: ComVisible (false)]
-
+++ /dev/null
-//
-// AssemblyLinkingTestFixture.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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 Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
- [TestFixture]
- public class AssemblyLinkingTestFixture : AbstractLinkingTestFixture {
-
- [Test]
- public void TestSimple ()
- {
- RunTest ("Simple");
- }
-
- [Test]
- public void TestVirtualCall ()
- {
- RunTest ("VirtualCall");
- }
-
- [Test]
- public void TestMultipleReferences ()
- {
- RunTest ("MultipleReferences");
- }
-
- protected override void RunTest (string testCase)
- {
- base.RunTest (testCase);
- Pipeline.PrependStep (
- new ResolveFromAssemblyStep (
- Path.Combine (GetTestCasePath (), "Program.exe")));
-
- Run ();
- }
- }
-}
+++ /dev/null
-//
-// IntegrationTestFixture.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
- [TestFixture]
- public class IntegrationTestFixture : AbstractTestFixture {
-
- [SetUp]
- public override void SetUp ()
- {
- base.SetUp ();
-
- TestCasesRoot = "Integration";
- }
-
- [Test]
- public void TestHelloWorld ()
- {
- RunTest ("HelloWorld");
- }
-
- [Test]
- public void TestCrypto ()
- {
- RunTest ("Crypto");
- }
-
- protected override LinkContext GetContext()
- {
- LinkContext context = base.GetContext ();
- context.CoreAction = AssemblyAction.Link;
- return context;
- }
-
- protected override Pipeline GetPipeline ()
- {
- Pipeline p = new Pipeline ();
- p.AppendStep (new LoadReferencesStep ());
- p.AppendStep (new BlacklistStep ());
- p.AppendStep (new TypeMapStep ());
- p.AppendStep (new MarkStep ());
- p.AppendStep (new SweepStep ());
- p.AppendStep (new CleanStep ());
- p.AppendStep (new OutputStep ());
- return p;
- }
-
- protected override void RunTest (string testCase)
- {
- if (!OnMono ())
- Assert.Ignore ("Integration tests are only runnable on Mono");
-
- base.RunTest (testCase);
- string test = Path.Combine (GetTestCasePath (), "Test.exe");
-
- string original = Execute (GetTestCasePath (), "Test.exe");
-
- Pipeline.PrependStep (
- new ResolveFromAssemblyStep (
- test));
-
- Run ();
-
- string linked = Execute (Context.OutputDirectory, "Test.exe");
-
- Assert.AreEqual (original, linked);
- }
-
- static bool OnMono ()
- {
- return Type.GetType ("System.MonoType") != null;
- }
-
- static string Execute (string directory, string file)
- {
- Process p = new Process ();
- p.StartInfo.EnvironmentVariables ["MONO_PATH"] = directory;
- p.StartInfo.CreateNoWindow = true;
- p.StartInfo.WorkingDirectory = directory;
- p.StartInfo.FileName = "mono";
- p.StartInfo.Arguments = file;
- p.StartInfo.RedirectStandardOutput = true;
- p.StartInfo.UseShellExecute = false;
-
- p.Start ();
- p.WaitForExit ();
-
- return p.StandardOutput.ReadToEnd ();
- }
- }
-}
+++ /dev/null
-//
-// XmlLinkingTestFixture.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Xml.XPath;
-
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-
-namespace Mono.Linker.Tests {
-
- [TestFixture]
- public class XmlLinkingTestFixture : AbstractLinkingTestFixture {
-
- [Test]
- public void TestSimpleXml ()
- {
- RunTest ("SimpleXml");
- }
-
- [Test]
- public void TestInterface ()
- {
- RunTest ("Interface");
- }
-
- [Test]
- public void TestReferenceInVirtualMethod ()
- {
- RunTest ("ReferenceInVirtualMethod");
- }
-
- [Test]
- public void TestGenerics ()
- {
- RunTest ("Generics");
- }
-
- [Test]
- public void TestNestedNested ()
- {
- RunTest ("NestedNested");
- }
-
- [Test]
- public void TestPreserveFieldsRequired ()
- {
- RunTest ("PreserveFieldsRequired");
- }
-
- [Test]
- public void TestReferenceInAttributes ()
- {
- RunTest ("ReferenceInAttributes");
- }
-
- [Test]
- public void TestXmlPattern ()
- {
- RunTest ("XmlPattern");
- }
-
- protected override void RunTest (string testCase)
- {
- base.RunTest (testCase);
- Pipeline.PrependStep (
- new ResolveFromXmlStep (
- new XPathDocument (Path.Combine (GetTestCasePath (), "desc.xml"))));
-
- Run ();
- }
- }
-}
+++ /dev/null
-using System;
-using System.Security.Cryptography;
-using System.Text;
-
-class Test {
-
- static void Main ()
- {
- byte [] foo = Encoding.UTF8.GetBytes ("foobared");
-
- HashAlgorithm ha = MD5.Create ();
- byte [] hash = ha.ComputeHash (foo);
-
- Console.WriteLine (Encoding.UTF8.GetString (hash));
- }
-}
+++ /dev/null
-using System;
-
-class Test {
-
- static void Main ()
- {
- Console.WriteLine ("Hello world!");
- }
-}
+++ /dev/null
-using System;
-
-public class Foo {
-
- void Bar ()
- {
- int i = 42;
- string s = "hey";
-
- Baz<int> bi = new Baz<int> (i);
- bi.Gazonk ();
- bi.Bat<string>(i, s);
-
- Baz<string> bs = new Baz<string> (s);
- bs.Gazonk ();
- bs.Bat<int>(s, i);
- bs.BiroBiro ();
-
- bs.Blam<Bang> ();
- }
-}
-
-public class Baz<T> {
-
- T _t;
-
- public Baz (T t)
- {
- _t = t;
- }
-
- public void Gazonk ()
- {
- Console.WriteLine (_t);
- }
-
- public void Bat<M> (T t, M m)
- {
- Console.WriteLine ("{0}{1}", t, m);
- }
-
- public void Blam<M> ()
- {
- }
-
- public T [] BiroBiro ()
- {
- return new T [0];
- }
-}
-
-class Bang {
-
- [NotLinked] public Bang ()
- {
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
+++ /dev/null
-using System;
-
-public class Foo : IFoo {
-
- public void Gazonk ()
- {
- }
-}
-
-public interface IFoo : IBar {
-}
-
-public interface IBar {
-
- void Gazonk ();
-}
-
-[NotLinked] public class Baz : IBaz {
-}
-
-[NotLinked] public interface IBaz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
+++ /dev/null
-using System;
-
-public class Bar {
-
- string bang = "bang !";
-
- public Bar ()
- {
- }
-
- public void Bang ()
- {
- Console.WriteLine (bang);
- }
-}
+++ /dev/null
-using System;
-
-public class Baz {
-
- public void Chain (Foo f)
- {
- f.b.Bang ();
- }
-
- [NotLinked] public void Lurman ()
- {
- }
-}
+++ /dev/null
-using System;
-
-public class Foo {
-
- public Bar b;
-
- public Foo (Bar b)
- {
- this.b = b;
- }
-
- public void UseBar ()
- {
- b.Bang ();
- }
-
- [NotLinked] public void Blam ()
- {
- }
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library NotLinkedAttribute.cs
- MCS /t:library Bar.cs
- MCS /t:library /r:Bar.dll /r:NotLinkedAttribute.dll Foo.cs
- MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
- MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
- MCS /r:Foo.dll /r:Bar.dll /r:Baz.dll /r:NotLinkedAttribute Program.cs
+++ /dev/null
-using System;
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-using System;
-
-public class Program {
-
- public static int Main ()
- {
- Program p = new Program ();
- p.Run ();
-
- return 0;
- }
-
- void Run ()
- {
- Foo f = new Foo (new Bar ());
- f.UseBar ();
-
- Baz b = new Baz ();
- b.Chain (f);
- }
-}
+++ /dev/null
-using System;
-
-public class Foo {
-}
-
-[NotLinked] public class Bar {
-
- [NotLinked] public class Baz {
-
- [NotLinked] public class Gazonk {
- }
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
+++ /dev/null
-using System;
-
-public class Foo {
-
- public Foo ()
- {
- new NotRequiredButUsedNotPreserved ();
- new NotRequiredButUsedAndFieldsPreserved ();
- }
-}
-
-public class NotRequiredButUsedNotPreserved {
-
- [NotLinked] public int foo;
- [NotLinked] public int bar;
-}
-
-public class NotRequiredButUsedAndFieldsPreserved {
-
- public int foo;
- public int bar;
-
- [NotLinked] public int FooBar ()
- {
- return foo + bar;
- }
-}
-
-[NotLinked] public class NotRequiredAndNotUsed {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- <type fullname="NotRequiredButUsedNotPreserved" preserve="nothing" required="false" />
- <type fullname="NotRequiredButUsedAndFieldsPreserved" preserve="fields" required="false" />
- </assembly>
-</linker>
+++ /dev/null
-using System;
-
-namespace LibLib {
-
- public class LibLibAttribute : Attribute {
-
- public Type LibLibType {
- [NotLinked] get { return null; }
- set {}
- }
- }
-
- public class BilBil {
-
- [NotLinked] public BilBil ()
- {
- }
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-using System;
-using LibLib;
-
-public class BarAttribute : Attribute {
-
- public BarAttribute ()
- {
- }
-
- public BarAttribute (Type type)
- {
- }
-
- public Type FieldType;
-
- public Type PropertyType {
- [NotLinked] get { return null; }
- set {}
- }
-}
-
-[Bar (typeof (Guy_A))]
-public class Foo {
-
- [Bar (FieldType = typeof (Guy_B))]
- public Foo a;
-
- [Bar (PropertyType = typeof (Guy_C))]
- public Foo b;
-
- [LibLib (LibLibType = typeof (BilBil))]
- public Foo c;
-
- [LibLib (LibLibType = typeof (Guy_D))]
- public Foo d;
-}
-
-public class Guy_A {
-
- [NotLinked] public Guy_A ()
- {
- }
-}
-
-public class Guy_B {
-
- [NotLinked] public Guy_B ()
- {
- }
-}
-
-public class Guy_C {
-
- [NotLinked] public Guy_C ()
- {
- }
-}
-
-public class Guy_D {
-
- [NotLinked] public Guy_D ()
- {
- }
-}
-
-[NotLinked] public class Baz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
+++ /dev/null
-
-using System;
-
-public class Foo {
-
- public void Do ()
- {
- Bar b = new Baz ();
- b.Bang ();
- }
-}
-
-public class Bar {
-
- public virtual void Bang ()
- {
- }
-}
-
-public class Baz : Bar {
-
- private string _hey;
-
- public string Hey {
- [NotLinked] get { return _hey; }
- [NotLinked] set { _hey = value; }
- }
-
- public override void Bang ()
- {
- Console.WriteLine (_hey);
- }
-}
-
-[NotLinked] public class NotLinkedAttribute : Attribute {}
\ No newline at end of file
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
+++ /dev/null
-using System;
-
-public class Library {
-
- private int _pouet;
- [NotLinked] private int _hey;
-
- public Library ()
- {
- _pouet = 1;
- }
-
- [NotLinked] public Library (int pouet)
- {
- _pouet = pouet;
- }
-
- public int Hello ()
- {
- Console.WriteLine ("Hello");
- return _pouet;
- }
-
- [NotLinked] public void Hey (int hey)
- {
- _hey = hey;
- Console.WriteLine (_hey);
- }
-}
-
-
-[NotLinked] public class Toy {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
- MCS /r:Library.dll Program.cs
+++ /dev/null
-using System;
-
-public class Program {
-
- public static int Main ()
- {
- Program p = new Program ();
- return p.Run ();
- }
-
- int Run ()
- {
- Library lib = new Library ();
- return lib.Hello ();
- }
-}
+++ /dev/null
-using System;
-
-public class Foo {
-
- int _baz;
- [NotLinked] int _shebang;
-
- public Foo ()
- {
- _baz = 42;
- }
-
- public int Baz ()
- {
- return _baz;
- }
-
- [NotLinked] public int Shebang (int bang)
- {
- return _shebang = bang * 2;
- }
-}
-
-public class Bar {
-
- int _truc;
-
- public Bar ()
- {
- _truc = 12;
- }
-
- public int Truc ()
- {
- return _truc;
- }
-}
-
-[NotLinked] public class Gazonk {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo">
- <field signature="System.Int32 _baz" />
- <method signature="System.Void .ctor()" />
- <method signature="System.Int32 Baz()" />
- </type>
- <type fullname="Bar" />
- </assembly>
-</linker>
+++ /dev/null
-using System;
-
-public class Library {
-
- public Library ()
- {
- }
-
- public int Shebang ()
- {
- return Bang ();
- }
-
- protected virtual int Bang ()
- {
- return 1;
- }
-}
-
-
-public class PowerFulLibrary : Library {
-
- protected override int Bang ()
- {
- return 0;
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
- MCS /r:Library.dll Program.cs
+++ /dev/null
-using System;
-
-public class Program {
-
- public static int Main ()
- {
- Program p = new Program ();
- return p.Run ();
- }
-
- int Run ()
- {
- Library lib = new PowerFulLibrary ();
- return lib.Shebang ();
- }
-}
+++ /dev/null
-using System;
-
-namespace Foo {
-
- [NotLinked] public class BarBar {
- }
-
- public class FooBaz {
-
- public FooBaz ()
- {
- }
-
- [NotLinked] public void BarBaz ()
- {
- }
- }
-
- public class TrucBaz {
-
- public TrucBaz ()
- {
- }
- }
-
- public class BazBaz {
-
- public BazBaz ()
- {
- }
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+++ /dev/null
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
+++ /dev/null
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo.*Baz">
- <method signature="System.Void .ctor()" />
- </type>
- </assembly>
-</linker>
+++ /dev/null
-
-MCS = mcs
-
+++ /dev/null
-#!/bin/sh
-VERSION=0.1
-prefix=/usr/local
-while test x$1 != x; do
- case $1 in
- --prefix=*)
- prefix=`echo $1 | sed 's/--prefix=//'`
- ;;
- --prefix)
- echo --prefix needs an argument: --prefix=directory >&2
- ;;
- *)
- echo Unknown argument $1 >&2
- esac
- shift
-done
-
-echo "prefix=$prefix" > config.make
-echo "RUNTIME=mono" >> config.make
-echo "ASSEMBLY_VERSION=$VERSION.0.0" >> config.make
-echo "VERSION=$VERSION" >> config.make
-
-echo "monolinker has been configure to be installed in $prefix"
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
</PropertyGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
- <Compile Include=".\Mono.Linker.Steps\BaseStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\BlacklistStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\CleanStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\IStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\LoadI18nAssemblies.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\LoadReferencesStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\MarkStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\OutputStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\RegenerateGuidStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\ResolveFromAssemblyStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\ResolveFromXApiStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\ResolveFromXmlStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\ResolveStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\SweepStep.cs" />\r
- <Compile Include=".\Mono.Linker.Steps\TypeMapStep.cs" />\r
- <Compile Include=".\Mono.Linker\Annotations.cs" />\r
- <Compile Include=".\Mono.Linker\AssemblyAction.cs" />\r
- <Compile Include=".\Mono.Linker\AssemblyInfo.cs" />\r
- <Compile Include=".\Mono.Linker\AssemblyResolver.cs" />\r
- <Compile Include=".\Mono.Linker\Driver.cs" />\r
- <Compile Include=".\Mono.Linker\I18nAssemblies.cs" />\r
- <Compile Include=".\Mono.Linker\IXApiVisitor.cs" />\r
- <Compile Include=".\Mono.Linker\LinkContext.cs" />\r
- <Compile Include=".\Mono.Linker\MethodAction.cs" />\r
- <Compile Include=".\Mono.Linker\Pipeline.cs" />\r
- <Compile Include=".\Mono.Linker\TypePreserve.cs" />\r
- <Compile Include=".\Mono.Linker\XApiReader.cs" />\r </ItemGroup>\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\BaseStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\BlacklistStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\CleanStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\IStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\LoadI18nAssemblies.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\LoadReferencesStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\MarkStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\OutputStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\RegenerateGuidStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveFromAssemblyStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveFromXApiStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveFromXmlStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\SweepStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\TypeMapStep.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\Annotations.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\AssemblyAction.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\AssemblyInfo.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\AssemblyResolver.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\Driver.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\I18nAssemblies.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\IXApiVisitor.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\LinkContext.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\MethodAction.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\Pipeline.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\TypePreserve.cs" />\r
+ <Compile Include="..\..\..\external\linker\linker\Mono.Linker\XApiReader.cs" />\r </ItemGroup>\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
Other similar extension points exist, see Microsoft.Common.targets.\r
<Target Name="BeforeBuild">\r
-./Mono.Linker/Pipeline.cs
-./Mono.Linker/AssemblyInfo.cs
-./Mono.Linker/AssemblyResolver.cs
-./Mono.Linker/TypePreserve.cs
-./Mono.Linker/Annotations.cs
-./Mono.Linker/LinkContext.cs
-./Mono.Linker/AssemblyAction.cs
-./Mono.Linker/Driver.cs
-./Mono.Linker/I18nAssemblies.cs
-./Mono.Linker/MethodAction.cs
-./Mono.Linker/XApiReader.cs
-./Mono.Linker/IXApiVisitor.cs
-./Mono.Linker.Steps/BaseStep.cs
-./Mono.Linker.Steps/LoadReferencesStep.cs
-./Mono.Linker.Steps/LoadI18nAssemblies.cs
-./Mono.Linker.Steps/ResolveFromXmlStep.cs
-./Mono.Linker.Steps/SweepStep.cs
-./Mono.Linker.Steps/RegenerateGuidStep.cs
-./Mono.Linker.Steps/ResolveFromXApiStep.cs
-./Mono.Linker.Steps/ResolveFromAssemblyStep.cs
-./Mono.Linker.Steps/ResolveStep.cs
-./Mono.Linker.Steps/CleanStep.cs
-./Mono.Linker.Steps/MarkStep.cs
-./Mono.Linker.Steps/BlacklistStep.cs
-./Mono.Linker.Steps/OutputStep.cs
-./Mono.Linker.Steps/TypeMapStep.cs
-./Mono.Linker.Steps/IStep.cs
+../../../external/linker/linker/Mono.Linker/Pipeline.cs
+../../../external/linker/linker/Mono.Linker/AssemblyInfo.cs
+../../../external/linker/linker/Mono.Linker/AssemblyResolver.cs
+../../../external/linker/linker/Mono.Linker/TypePreserve.cs
+../../../external/linker/linker/Mono.Linker/Annotations.cs
+../../../external/linker/linker/Mono.Linker/LinkContext.cs
+../../../external/linker/linker/Mono.Linker/AssemblyAction.cs
+../../../external/linker/linker/Mono.Linker/Driver.cs
+../../../external/linker/linker/Mono.Linker/I18nAssemblies.cs
+../../../external/linker/linker/Mono.Linker/MethodAction.cs
+../../../external/linker/linker/Mono.Linker/XApiReader.cs
+../../../external/linker/linker/Mono.Linker/IXApiVisitor.cs
+../../../external/linker/linker/Mono.Linker.Steps/BaseStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/LoadReferencesStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/SweepStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/RegenerateGuidStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/CleanStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/MarkStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/BlacklistStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/OutputStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/TypeMapStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/IStep.cs
+++ /dev/null
-#!/bin/sh
-mono $MONO_EXTRA_ARGS @prefix@/lib/mink/mink.exe "$@"
+++ /dev/null
-SRC = link.c
-OBJ = libmono-profiler-link.so
-
-all:
- gcc -g -Wall -shared -o $(OBJ) $(SRC) `pkg-config --cflags --libs mono`
-
-clean:
- rm -f $(OBJ)
+++ /dev/null
-/*
- * link.c: a profiler to help the static linker
- *
- * Authors:
- * Jb Evain (jbevain@novell.com)
- *
- * (C) 2007 Novell, Inc. http://www.novell.com
- *
- */
-#include <glib.h>
-#include <string.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/class.h>
-#include <mono/metadata/image.h>
-#include <mono/metadata/metadata.h>
-#include <mono/metadata/profiler.h>
-
-struct _MonoProfiler {
- const char *output_file;
- GHashTable *images;
-};
-
-typedef struct _LinkedImage {
- MonoImage *image;
- GHashTable *types;
-} LinkedImage;
-
-typedef struct _LinkedType {
- MonoClass *klass;
- GHashTable *methods;
-} LinkedType;
-
-typedef struct _LinkedMethod {
- MonoMethod *method;
-} LinkedMethod;
-
-static void
-link_append_class_name (GString *res, MonoClass *klass, gboolean include_namespace)
-{
- if (!klass) {
- g_string_append (res, "**unknown**");
- return;
- }
-
- if (mono_class_get_nesting_type (klass)) {
- link_append_class_name (res, mono_class_get_nesting_type (klass), include_namespace);
- g_string_append_c (res, '/');
- }
-
- if (include_namespace && *(mono_class_get_namespace (klass)))
- g_string_sprintfa (res, "%s.", mono_class_get_namespace (klass));
-
- g_string_sprintfa (res, "%s", mono_class_get_name (klass));
-}
-
-static MonoType *
-link_get_element_type (MonoType *type)
-{
- return mono_class_get_type (mono_class_get_element_class (mono_class_from_mono_type (type)));
-}
-
-static void
-link_type_get_desc (GString *res, MonoType *type, gboolean include_namespace) {
- switch (mono_type_get_type (type)) {
- case MONO_TYPE_VOID:
- g_string_append (res, "System.Void"); break;
- case MONO_TYPE_CHAR:
- g_string_append (res, "System.Char"); break;
- case MONO_TYPE_BOOLEAN:
- g_string_append (res, "System.Boolean"); break;
- case MONO_TYPE_U1:
- g_string_append (res, "System.Byte"); break;
- case MONO_TYPE_I1:
- g_string_append (res, "System.SByte"); break;
- case MONO_TYPE_U2:
- g_string_append (res, "System.UInt16"); break;
- case MONO_TYPE_I2:
- g_string_append (res, "System.Int16"); break;
- case MONO_TYPE_U4:
- g_string_append (res, "System.UInt32"); break;
- case MONO_TYPE_I4:
- g_string_append (res, "System.Int32"); break;
- case MONO_TYPE_U8:
- g_string_append (res, "System.UInt64"); break;
- case MONO_TYPE_I8:
- g_string_append (res, "System.Int64"); break;
- case MONO_TYPE_FNPTR:
- g_string_append (res, "*()"); break;
- case MONO_TYPE_U:
- g_string_append (res, "System.UIntPtr"); break;
- case MONO_TYPE_I:
- g_string_append (res, "System.IntPtr"); break;
- case MONO_TYPE_R4:
- g_string_append (res, "System.Single"); break;
- case MONO_TYPE_R8:
- g_string_append (res, "System.Double"); break;
- case MONO_TYPE_STRING:
- g_string_append (res, "System.String"); break;
- case MONO_TYPE_OBJECT:
- g_string_append (res, "System.Object"); break;
- case MONO_TYPE_PTR:
- link_type_get_desc (res, mono_type_get_ptr_type (type), include_namespace);
- g_string_append_c (res, '*');
- break;
- case MONO_TYPE_ARRAY: {
- MonoClass *eklass = mono_class_get_element_class (mono_class_from_mono_type (type));
- link_type_get_desc (res, mono_class_get_type (eklass), include_namespace);
- g_string_sprintfa (res, "[%d]", mono_class_get_rank (eklass));
- break;
- }
- case MONO_TYPE_SZARRAY:
- link_type_get_desc (res, link_get_element_type (type), include_namespace);
- g_string_append (res, "[]");
- break;
- case MONO_TYPE_CLASS:
- case MONO_TYPE_VALUETYPE:
- link_append_class_name (res, mono_type_get_class (type), include_namespace);
- break;
- case MONO_TYPE_GENERICINST:
- //link_type_get_desc (res, &type->data.generic_class->container_class->byval_arg, include_namespace); /* ? */
- break;
- case MONO_TYPE_VAR:
- case MONO_TYPE_MVAR:
- //g_string_append (res, type->data.generic_param->name); /* ? */
- break;
- default:
- break;
- }
- if (mono_type_is_byref (type))
- g_string_append (res, "&");
-}
-
-static char *
-link_type_full_name (MonoType *type)
-{
- GString *str;
- char *res;
-
- str = g_string_new ("");
- link_type_get_desc (str, type, TRUE);
-
- res = g_strdup (str->str);
- g_string_free (str, TRUE);
- return res;
-}
-
-static char *
-link_class_full_name (MonoClass *klass)
-{
- return link_type_full_name (mono_class_get_type (klass));
-}
-
-static char *
-link_signature_get_desc (MonoMethodSignature *sig, gboolean include_namespace)
-{
- int i;
- char *result;
- GString *res = g_string_new ("");
-
- for (i = 0; i < sig->param_count; ++i) {
- if (i > 0)
- g_string_append_c (res, ',');
- link_type_get_desc (res, sig->params [i], include_namespace);
- }
- result = res->str;
- g_string_free (res, FALSE);
- return result;
-}
-
-static char *
-link_method_signature (MonoMethod *method)
-{
- MonoMethodSignature *sig;
- char *res;
-
- sig = mono_method_signature (method);
- char *tmpsig = link_signature_get_desc (sig, TRUE);
- res = g_strdup_printf ("%s %s(%s)",
- link_type_full_name (mono_signature_get_return_type (sig)),
- mono_method_get_name (method), tmpsig);
- g_free (tmpsig);
-
- return res;
-}
-
-static char *
-link_image_fullname (MonoImage *image)
-{
- MonoAssemblyName *name;
- char *res;
-
- name = g_new0 (MonoAssemblyName, 1);
- mono_assembly_fill_assembly_name (image, name);
- res = mono_stringify_assembly_name (name);
- g_free (name);
- return res;
-}
-
-static LinkedType *
-link_get_linked_type (LinkedImage *limage, MonoClass *klass)
-{
- LinkedType *ltype;
-
- ltype = (LinkedType *) g_hash_table_lookup (limage->types, klass);
-
- if (ltype)
- return ltype;
-
- ltype = g_new0 (LinkedType, 1);
- ltype->klass = klass;
- ltype->methods = g_hash_table_new (NULL, NULL);
- g_hash_table_insert (limage->types, klass, ltype);
- return ltype;
-}
-
-static LinkedImage *
-link_get_linked_image (MonoProfiler *prof, MonoImage *image)
-{
- LinkedImage *limage;
-
- limage = (LinkedImage *) g_hash_table_lookup (prof->images, image);
-
- if (limage)
- return limage;
-
- limage = g_new0 (LinkedImage, 1);
- limage->image = image;
- limage->types = g_hash_table_new (NULL, NULL);
- g_hash_table_insert (prof->images, image, limage);
- return limage;
-}
-
-static void
-link_method_leave (MonoProfiler *prof, MonoMethod *method)
-{
- MonoClass *klass;
- MonoImage *image;
-
- LinkedType *ltype;
- LinkedImage *limage;
- LinkedMethod *lmethod;
-
- klass = mono_method_get_class (method);
- image = mono_class_get_image (klass);
-
- limage = link_get_linked_image (prof, image);
- ltype = link_get_linked_type (limage, klass);
-
- lmethod = (LinkedMethod *) g_hash_table_lookup (ltype->methods, method);
- if (lmethod)
- return;
-
- lmethod = g_new0 (LinkedMethod, 1);
- lmethod->method = method;
- g_hash_table_insert (ltype->methods, method, lmethod);
-}
-
-static void
-link_free_member (gpointer key, gpointer value, gpointer data)
-{
- g_free (value);
-}
-
-static void
-link_free_type (gpointer key, gpointer value, gpointer data)
-{
- LinkedType *type = (LinkedType *) value;
-
- g_hash_table_foreach (type->methods, link_free_member, NULL);
- g_free (type);
-}
-
-static void
-link_free_image (gpointer key, gpointer value, gpointer data)
-{
- LinkedImage *image = (LinkedImage *) value;
-
- g_hash_table_foreach (image->types, link_free_type, NULL);
- g_free (image);
-}
-
-static void
-link_print_method (gpointer key, gpointer value, gpointer data)
-{
- LinkedMethod *lmethod = (LinkedMethod *) value;
- FILE *output = (FILE *) data;
- char *signature;
-
- signature = link_method_signature (lmethod->method);
- fprintf (output, "\t\t\t<method signature=\"%s\" />\n", signature);
- g_free (signature);
-}
-
-static void
-link_print_type (gpointer key, gpointer value, gpointer data)
-{
- LinkedType *ltype = (LinkedType *) value;
- FILE *output = (FILE *) data;
- char *fullname;
-
- fullname = link_class_full_name (ltype->klass);
- fprintf (output, "\t\t<type fullname=\"%s\">\n", fullname);
- g_free (fullname);
-
- g_hash_table_foreach (ltype->methods, link_print_method, output);
- fprintf (output, "\t\t</type>\n");
-}
-
-static void
-link_print_image (gpointer key, gpointer value, gpointer data)
-{
- LinkedImage *limage = (LinkedImage *) value;
- FILE *output = (FILE *) data;
- char *fullname;
-
- fullname = link_image_fullname (limage->image);
- fprintf (output, "\t<assembly fullname=\"%s\">\n", fullname);
- g_free (fullname);
- g_hash_table_foreach (limage->types, link_print_type, output);
- fprintf (output, "\t</assembly>\n");
-}
-
-static void
-link_print_tree (MonoProfiler *prof)
-{
- FILE *output;
-
- output = fopen (prof->output_file, "w");
- fprintf (output, "<linker>\n");
- g_hash_table_foreach (prof->images, link_print_image, output);
- fprintf (output, "</linker>\n");
- fclose (output);
-}
-
-static void
-link_shutdown (MonoProfiler *prof)
-{
- link_print_tree (prof);
- g_hash_table_foreach (prof->images, link_free_image, NULL);
- g_free (prof);
-}
-
-void
-mono_profiler_startup (const char *desc)
-{
- MonoProfiler *prof;
-
- prof = g_new0 (MonoProfiler, 1);
-
- if (strncmp ("link:", desc, 5) == 0 && desc [5])
- prof->output_file = g_strdup (desc + 5);
- else
- prof->output_file = "link.xml";
-
- prof->images = g_hash_table_new (NULL, NULL);
-
- mono_profiler_install (prof, link_shutdown);
-
- mono_profiler_install_enter_leave (NULL, link_method_leave);
-
- mono_profiler_set_events (MONO_PROFILE_ENTER_LEAVE);
-}
+++ /dev/null
-
-MCS = mcs
-KEY_FILE = ../../class/mono.snk
-MONO.CECIL.DLL = Mono.Cecil.dll
-MCS_FLAGS = -debug -keyfile:$(KEY_FILE) -r:$(MONO.CECIL.DLL) -resource:Descriptors/mscorlib.xml -resource:Descriptors/System.xml -resource:Descriptors/System.Web.xml -resource:Descriptors/Mono.Posix.xml -resource:Descriptors/System.Drawing.xml
-LINKER = monolinker.exe
-
-all: config.make monolinker.exe monolinker
-
-monolinker: monolinker.in Makefile
- sed "s,@prefix@,$(prefix)," < monolinker.in > monolinker
- chmod +x monolinker
-
-monolinker.exe: Mono.Cecil.dll
- $(MCS) $(MCS_FLAGS) @$(LINKER).sources /out:$(LINKER)
-
-Mono.Cecil.dll:
- if pkg-config --atleast-version=0.5 mono-cecil; then \
- cp `pkg-config --variable=Libraries mono-cecil` .; \
- else \
- echo You must install Mono.Cecil first; \
- exit 1; \
- fi
-
-clean:
- rm -f $(LINKER) $(MONO.CECIL.DLL) monolinker
-
-install: all
- mkdir -p $(prefix)/bin
- mkdir -p $(prefix)/lib/monolinker
- cp $(LINKER) $(MONO.CECIL.DLL) $(prefix)/lib/monolinker
- cp monolinker $(prefix)/bin
- cp man/monolinker.1 $(prefix)/share/man/man1
-
-config.make:
- echo You must run configure first
- exit 1
-
-include config.make
-
-run-test: all
- cd ./Tests; \
- make clean run-test; \
- cd ..;
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+++ /dev/null
-thisdir = tools/tuner
-SUBDIRS =
-DEP_DIRS = linker
-include ../../build/rules.make
-
-LOCAL_MCS_FLAGS = -r:$(topdir)/class/lib/$(PROFILE)/monolinker.exe
-LIB_REFS = System System.Core System.Xml Mono.Cecil
-
-LIBRARY = Mono.Tuner.dll
-
-NO_INSTALL = yes
-NO_TEST = yes
-NO_SIGN_ASSEMBLY = yes
-
-include ../../build/library.make
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProductVersion>9.0.30729</ProductVersion>\r
- <SchemaVersion>2.0</SchemaVersion>\r
- <ProjectGuid>{8CCE7044-3466-4599-B09E-9F8E0C2F4614}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <NoWarn>1699</NoWarn>\r
- <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
- <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
- <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
- <NoStdLib>True</NoStdLib>\r
- \r
- <NoConfig>True</NoConfig>\r
- \r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>\r
- </RootNamespace>\r
- <AssemblyName>Mono.Tuner</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
- <FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- \r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <NoWarn>1699</NoWarn>\r
- <Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <NoWarn>1699</NoWarn>\r
- <Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
- Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
- is a problem to compile the Mono mscorlib.dll -->\r
- <PropertyGroup>\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
- </PropertyGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <ItemGroup>\r
- <Compile Include="Mono.Tuner\AdjustVisibility.cs" />\r
- <Compile Include="Mono.Tuner\CheckVisibility.cs" />\r
- <Compile Include="Mono.Tuner\FilterAttributes.cs" />\r
- <Compile Include="Mono.Tuner\InjectSecurityAttributes.cs" />\r
- <Compile Include="Mono.Tuner\MoonlightA11yApiMarker.cs" />\r
- <Compile Include="Mono.Tuner\MoonlightA11yAssemblyStep.cs" />\r
- <Compile Include="Mono.Tuner\MoonlightA11yDescriptorGenerator.cs" />\r
- <Compile Include="Mono.Tuner\MoonlightA11yProcessor.cs" />\r
- <Compile Include="Mono.Tuner\MoonlightA11yUsageInspectionStep.cs" />\r
- <Compile Include="Mono.Tuner\MoonlightAssemblyStep.cs" />\r
- <Compile Include="Mono.Tuner\PrintStatus.cs" />\r
- <Compile Include="Mono.Tuner\RemoveSerialization.cs" />\r
- <Compile Include="Mono.Tuner\TunerAnnotations.cs" />\r </ItemGroup>\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
- <PropertyGroup>\r
- <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PreBuildEvent>\r
- <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PreBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
- </PostBuildEvent>\r
- <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
- </PostBuildEvent>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="../linker/monolinker-net_4_x.csproj">\r
- <Project>{FA920637-C202-4E75-AC0F-1A8DBD631DF1}</Project>\r
- <Name>monolinker-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../../class/corlib/corlib-net_4_x.csproj">\r
- <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
- <Name>corlib-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../../class/System/System-net_4_x.csproj">\r
- <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
- <Name>System-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../../class/System.Core/System.Core-net_4_x.csproj">\r
- <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
- <Name>System.Core-net_4_x</Name>\r
- </ProjectReference>\r
- <ProjectReference Include="../../class/System.XML/System.Xml-net_4_x.csproj">\r
- <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
- <Name>System.Xml-net_4_x</Name>\r
- </ProjectReference>\r
- <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
- <SpecificVersion>False</SpecificVersion>\r
- <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
- <Private>False</Private>\r
- </Reference>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Folder Include="Properties\" />\r
- </ItemGroup>\r
-</Project>\r
-
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{E97429BA-279A-4C1D-AE8A-8BD878C661D1}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Mono.Tuner</RootNamespace>
- <AssemblyName>Mono.Tuner</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>True</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>False</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>True</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Mono.Tuner\AdjustVisibility.cs" />
- <Compile Include="Mono.Tuner\CheckVisibility.cs" />
- <Compile Include="Mono.Tuner\PrintStatus.cs" />
- <Compile Include="Mono.Tuner\RemoveSerialization.cs" />
- <Compile Include="Mono.Tuner\TunerAnnotations.cs" />
- <Compile Include="Mono.Tuner\InjectSecurityAttributes.cs" />
- <Compile Include="Mono.Tuner\MoonlightAssemblyStep.cs" />
- <Compile Include="Mono.Tuner\FilterAttributes.cs" />
- <Compile Include="Mono.Tuner\MoonlightA11yProcessor.cs" />
- <Compile Include="Mono.Tuner\MoonlightA11yAssemblyStep.cs" />
- <Compile Include="Mono.Tuner\MoonlightA11yUsageInspectionStep.cs" />
- <Compile Include="Mono.Tuner\MoonlightA11yDescriptorGenerator.cs" />
- <Compile Include="Mono.Tuner\MoonlightA11yApiMarker.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ItemGroup>
- <None Include="Makefile" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\linker\Mono.Linker.csproj">
- <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
- <Name>Mono.Linker</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\external\cecil\Mono.Cecil.csproj">
- <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
- <Name>Mono.Cecil</Name>
- </ProjectReference>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-Mono.Tuner/TunerAnnotations.cs
-Mono.Tuner/PrintStatus.cs
-Mono.Tuner/RemoveSerialization.cs
-Mono.Tuner/AdjustVisibility.cs
-Mono.Tuner/CheckVisibility.cs
-Mono.Tuner/InjectSecurityAttributes.cs
-Mono.Tuner/MoonlightA11yApiMarker.cs
-Mono.Tuner/MoonlightA11yAssemblyStep.cs
-Mono.Tuner/MoonlightA11yDescriptorGenerator.cs
-Mono.Tuner/MoonlightA11yProcessor.cs
-Mono.Tuner/MoonlightA11yUsageInspectionStep.cs
-Mono.Tuner/MoonlightAssemblyStep.cs
-Mono.Tuner/FilterAttributes.cs
+++ /dev/null
-//
-// AdjustVisibilityStep.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class AdjustVisibility : BaseStep {
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- ProcessTypes (assembly.MainModule.Types);
- }
-
- void ProcessTypes (ICollection types)
- {
- foreach (TypeDefinition type in types)
- ProcessType (type);
- }
-
- void ProcessType (TypeDefinition type)
- {
- if (!IsPublic (type))
- return;
-
- if (!IsMarkedAsPublic (type)) {
- SetInternalVisibility (type);
- return;
- }
-
- if (type.IsEnum)
- return;
-
- ProcessFields (type.Fields);
- ProcessMethods (type.Methods);
- }
-
- static bool IsPublic (TypeDefinition type)
- {
- return type.DeclaringType == null ? type.IsPublic : type.IsNestedPublic;
- }
-
- void SetInternalVisibility (TypeDefinition type)
- {
- type.Attributes &= ~TypeAttributes.VisibilityMask;
- if (type.DeclaringType == null)
- type.Attributes |= TypeAttributes.NotPublic;
- else
- type.Attributes |= TypeAttributes.NestedAssembly;
-
- MarkInternalized (type);
- }
-
- void ProcessMethods (ICollection methods)
- {
- foreach (MethodDefinition method in methods)
- ProcessMethod (method);
- }
-
- void ProcessMethod (MethodDefinition method)
- {
- if (IsMarkedAsPublic (method))
- return;
-
- if (method.IsPublic)
- SetInternalVisibility (method);
- else if (method.IsFamily || method.IsFamilyOrAssembly)
- SetProtectedAndInternalVisibility (method);
- }
-
- void SetInternalVisibility (MethodDefinition method)
- {
- method.Attributes &= ~MethodAttributes.MemberAccessMask;
- method.Attributes |= MethodAttributes.Assembly;
-
- MarkInternalized (method);
- }
-
- void SetProtectedAndInternalVisibility (MethodDefinition method)
- {
- method.Attributes &= ~MethodAttributes.MemberAccessMask;
- method.Attributes |= MethodAttributes.FamANDAssem;
-
- MarkInternalized (method);
- }
-
- bool IsMarkedAsPublic (IMetadataTokenProvider provider)
- {
- return Annotations.IsPublic (provider);
- }
-
- void ProcessFields (IEnumerable<FieldDefinition> fields)
- {
- foreach (FieldDefinition field in fields)
- ProcessField (field);
- }
-
- void ProcessField (FieldDefinition field)
- {
- if (IsMarkedAsPublic (field))
- return;
-
- if (field.IsPublic)
- SetInternalVisibility (field);
- else if (field.IsFamily || field.IsFamilyOrAssembly)
- SetProtectedAndInternalVisibility (field);
- }
-
- void SetInternalVisibility (FieldDefinition field)
- {
- field.Attributes &= ~FieldAttributes.FieldAccessMask;
- field.Attributes |= FieldAttributes.Assembly;
-
- MarkInternalized (field);
- }
-
- void SetProtectedAndInternalVisibility (FieldDefinition field)
- {
- field.Attributes &= ~FieldAttributes.FieldAccessMask;
- field.Attributes |= FieldAttributes.FamANDAssem;
-
- MarkInternalized (field);
- }
-
- void MarkInternalized (IMetadataTokenProvider provider)
- {
- TunerAnnotations.Internalized (Context, provider);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public abstract class ApplyPreserveAttributeBase : BaseSubStep {
-
- // set 'removeAttribute' to true if you want the preserved attribute to be removed from the final assembly
- protected abstract bool IsPreservedAttribute (ICustomAttributeProvider provider, CustomAttribute attribute, out bool removeAttribute);
-
- public override SubStepTargets Targets {
- get {
- return SubStepTargets.Type
- | SubStepTargets.Field
- | SubStepTargets.Method
- | SubStepTargets.Property
- | SubStepTargets.Event;
- }
- }
-
- public override bool IsActiveFor (AssemblyDefinition assembly)
- {
- return !Profile.IsSdkAssembly (assembly) && Annotations.GetAction (assembly) == AssemblyAction.Link;
- }
-
- public override void ProcessType (TypeDefinition type)
- {
- TryApplyPreserveAttribute (type);
- }
-
- public override void ProcessField (FieldDefinition field)
- {
- foreach (var attribute in GetPreserveAttributes (field))
- Mark (field, attribute);
- }
-
- public override void ProcessMethod (MethodDefinition method)
- {
- MarkMethodIfPreserved (method);
- }
-
- public override void ProcessProperty (PropertyDefinition property)
- {
- foreach (var attribute in GetPreserveAttributes (property)) {
- MarkMethod (property.GetMethod, attribute);
- MarkMethod (property.SetMethod, attribute);
- }
- }
-
- public override void ProcessEvent (EventDefinition @event)
- {
- foreach (var attribute in GetPreserveAttributes (@event)) {
- MarkMethod (@event.AddMethod, attribute);
- MarkMethod (@event.InvokeMethod, attribute);
- MarkMethod (@event.RemoveMethod, attribute);
- }
- }
-
- void MarkMethodIfPreserved (MethodDefinition method)
- {
- foreach (var attribute in GetPreserveAttributes (method))
- MarkMethod (method, attribute);
- }
-
- void MarkMethod (MethodDefinition method, CustomAttribute preserve_attribute)
- {
- if (method == null)
- return;
-
- Mark (method, preserve_attribute);
- Annotations.SetAction (method, MethodAction.Parse);
- }
-
- void Mark (IMetadataTokenProvider provider, CustomAttribute preserve_attribute)
- {
- if (IsConditionalAttribute (preserve_attribute)) {
- PreserveConditional (provider);
- return;
- }
-
- PreserveUnconditional (provider);
- }
-
- void PreserveConditional (IMetadataTokenProvider provider)
- {
- var method = provider as MethodDefinition;
- if (method == null) {
- // workaround to support (uncommon but valid) conditional fields form [Preserve]
- PreserveUnconditional (provider);
- return;
- }
-
- Annotations.AddPreservedMethod (method.DeclaringType, method);
- }
-
- static bool IsConditionalAttribute (CustomAttribute attribute)
- {
- if (attribute == null)
- return false;
-
- foreach (var named_argument in attribute.Fields)
- if (named_argument.Name == "Conditional")
- return (bool) named_argument.Argument.Value;
-
- return false;
- }
-
- void PreserveUnconditional (IMetadataTokenProvider provider)
- {
- Annotations.Mark (provider);
-
- var member = provider as IMemberDefinition;
- if (member == null || member.DeclaringType == null)
- return;
-
- Mark (member.DeclaringType, null);
- }
-
- void TryApplyPreserveAttribute (TypeDefinition type)
- {
- foreach (var attribute in GetPreserveAttributes (type)) {
- Annotations.Mark (type);
-
- if (!attribute.HasFields)
- continue;
-
- foreach (var named_argument in attribute.Fields)
- if (named_argument.Name == "AllMembers" && (bool)named_argument.Argument.Value)
- Annotations.SetPreserve (type, TypePreserve.All);
- }
- }
-
- List<CustomAttribute> GetPreserveAttributes (ICustomAttributeProvider provider)
- {
- List<CustomAttribute> attrs = new List<CustomAttribute> ();
-
- if (!provider.HasCustomAttributes)
- return attrs;
-
- var attributes = provider.CustomAttributes;
-
- for (int i = attributes.Count - 1; i >= 0; i--) {
- var attribute = attributes [i];
-
- bool remote_attribute;
- if (!IsPreservedAttribute (provider, attribute, out remote_attribute))
- continue;
-
- attrs.Add (attribute);
- if (remote_attribute)
- attributes.RemoveAt (i);
- }
-
- return attrs;
- }
- }
-}
+++ /dev/null
-//
-// MethodBodyRocks.cs
-//
-// Author:
-// Jb Evain (jbevain@gmail.com)
-//
-// Copyright (c) 2008 - 2011 Jb Evain
-//
-// 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.Linq;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
- public static class MethodBodyRocks {
-
- public static IEnumerable<TypeDefinition> GetAllTypes (this ModuleDefinition self)
- {
- return self.Types.SelectMany (t => t.GetAllTypes ());
- }
-
- static IEnumerable<TypeDefinition> GetAllTypes (this TypeDefinition self)
- {
- yield return self;
-
- if (!self.HasNestedTypes)
- yield break;
-
- foreach (var type in self.NestedTypes.SelectMany (t => t.GetAllTypes ()))
- yield return type;
- }
-
- public static IEnumerable<MethodDefinition> GetMethods (this TypeDefinition self)
- {
- return self.Methods.Where (m => !m.IsConstructor);
- }
-
- public static IEnumerable<MethodDefinition> GetConstructors (this TypeDefinition self)
- {
- return self.Methods.Where (m => m.IsConstructor);
- }
-
- public static MethodDefinition GetTypeConstructor (this TypeDefinition self)
- {
- return self.GetConstructors ().FirstOrDefault (c => c.IsStatic);
- }
-
- public static void SimplifyMacros (this MethodBody self)
- {
- if (self == null)
- throw new ArgumentNullException ("self");
-
- foreach (var instruction in self.Instructions) {
- if (instruction.OpCode.OpCodeType != OpCodeType.Macro)
- continue;
-
- switch (instruction.OpCode.Code) {
- case Code.Ldarg_0:
- ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (0));
- break;
- case Code.Ldarg_1:
- ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (1));
- break;
- case Code.Ldarg_2:
- ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (2));
- break;
- case Code.Ldarg_3:
- ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (3));
- break;
- case Code.Ldloc_0:
- ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [0]);
- break;
- case Code.Ldloc_1:
- ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [1]);
- break;
- case Code.Ldloc_2:
- ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [2]);
- break;
- case Code.Ldloc_3:
- ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [3]);
- break;
- case Code.Stloc_0:
- ExpandMacro (instruction, OpCodes.Stloc, self.Variables [0]);
- break;
- case Code.Stloc_1:
- ExpandMacro (instruction, OpCodes.Stloc, self.Variables [1]);
- break;
- case Code.Stloc_2:
- ExpandMacro (instruction, OpCodes.Stloc, self.Variables [2]);
- break;
- case Code.Stloc_3:
- ExpandMacro (instruction, OpCodes.Stloc, self.Variables [3]);
- break;
- case Code.Ldarg_S:
- instruction.OpCode = OpCodes.Ldarg;
- break;
- case Code.Ldarga_S:
- instruction.OpCode = OpCodes.Ldarga;
- break;
- case Code.Starg_S:
- instruction.OpCode = OpCodes.Starg;
- break;
- case Code.Ldloc_S:
- instruction.OpCode = OpCodes.Ldloc;
- break;
- case Code.Ldloca_S:
- instruction.OpCode = OpCodes.Ldloca;
- break;
- case Code.Stloc_S:
- instruction.OpCode = OpCodes.Stloc;
- break;
- case Code.Ldc_I4_M1:
- ExpandMacro (instruction, OpCodes.Ldc_I4, -1);
- break;
- case Code.Ldc_I4_0:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 0);
- break;
- case Code.Ldc_I4_1:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 1);
- break;
- case Code.Ldc_I4_2:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 2);
- break;
- case Code.Ldc_I4_3:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 3);
- break;
- case Code.Ldc_I4_4:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 4);
- break;
- case Code.Ldc_I4_5:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 5);
- break;
- case Code.Ldc_I4_6:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 6);
- break;
- case Code.Ldc_I4_7:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 7);
- break;
- case Code.Ldc_I4_8:
- ExpandMacro (instruction, OpCodes.Ldc_I4, 8);
- break;
- case Code.Ldc_I4_S:
- ExpandMacro (instruction, OpCodes.Ldc_I4, (int) (sbyte) instruction.Operand);
- break;
- case Code.Br_S:
- instruction.OpCode = OpCodes.Br;
- break;
- case Code.Brfalse_S:
- instruction.OpCode = OpCodes.Brfalse;
- break;
- case Code.Brtrue_S:
- instruction.OpCode = OpCodes.Brtrue;
- break;
- case Code.Beq_S:
- instruction.OpCode = OpCodes.Beq;
- break;
- case Code.Bge_S:
- instruction.OpCode = OpCodes.Bge;
- break;
- case Code.Bgt_S:
- instruction.OpCode = OpCodes.Bgt;
- break;
- case Code.Ble_S:
- instruction.OpCode = OpCodes.Ble;
- break;
- case Code.Blt_S:
- instruction.OpCode = OpCodes.Blt;
- break;
- case Code.Bne_Un_S:
- instruction.OpCode = OpCodes.Bne_Un;
- break;
- case Code.Bge_Un_S:
- instruction.OpCode = OpCodes.Bge_Un;
- break;
- case Code.Bgt_Un_S:
- instruction.OpCode = OpCodes.Bgt_Un;
- break;
- case Code.Ble_Un_S:
- instruction.OpCode = OpCodes.Ble_Un;
- break;
- case Code.Blt_Un_S:
- instruction.OpCode = OpCodes.Blt_Un;
- break;
- case Code.Leave_S:
- instruction.OpCode = OpCodes.Leave;
- break;
- }
- }
- }
-
- static void ExpandMacro (Instruction instruction, OpCode opcode, object operand)
- {
- instruction.OpCode = opcode;
- instruction.Operand = operand;
- }
-
- static void MakeMacro (Instruction instruction, OpCode opcode)
- {
- instruction.OpCode = opcode;
- instruction.Operand = null;
- }
-
- public static void OptimizeMacros (this MethodBody self)
- {
- if (self == null)
- throw new ArgumentNullException ("self");
-
- var method = self.Method;
-
- foreach (var instruction in self.Instructions) {
- int index;
- switch (instruction.OpCode.Code) {
- case Code.Ldarg:
- index = ((ParameterDefinition) instruction.Operand).Index;
- if (index == -1 && instruction.Operand == self.ThisParameter)
- index = 0;
- else if (method.HasThis)
- index++;
-
- switch (index) {
- case 0:
- MakeMacro (instruction, OpCodes.Ldarg_0);
- break;
- case 1:
- MakeMacro (instruction, OpCodes.Ldarg_1);
- break;
- case 2:
- MakeMacro (instruction, OpCodes.Ldarg_2);
- break;
- case 3:
- MakeMacro (instruction, OpCodes.Ldarg_3);
- break;
- default:
- if (index < 256)
- ExpandMacro (instruction, OpCodes.Ldarg_S, instruction.Operand);
- break;
- }
- break;
- case Code.Ldloc:
- index = ((VariableDefinition) instruction.Operand).Index;
- switch (index) {
- case 0:
- MakeMacro (instruction, OpCodes.Ldloc_0);
- break;
- case 1:
- MakeMacro (instruction, OpCodes.Ldloc_1);
- break;
- case 2:
- MakeMacro (instruction, OpCodes.Ldloc_2);
- break;
- case 3:
- MakeMacro (instruction, OpCodes.Ldloc_3);
- break;
- default:
- if (index < 256)
- ExpandMacro (instruction, OpCodes.Ldloc_S, instruction.Operand);
- break;
- }
- break;
- case Code.Stloc:
- index = ((VariableDefinition) instruction.Operand).Index;
- switch (index) {
- case 0:
- MakeMacro (instruction, OpCodes.Stloc_0);
- break;
- case 1:
- MakeMacro (instruction, OpCodes.Stloc_1);
- break;
- case 2:
- MakeMacro (instruction, OpCodes.Stloc_2);
- break;
- case 3:
- MakeMacro (instruction, OpCodes.Stloc_3);
- break;
- default:
- if (index < 256)
- ExpandMacro (instruction, OpCodes.Stloc_S, instruction.Operand);
- break;
- }
- break;
- case Code.Ldarga:
- index = ((ParameterDefinition) instruction.Operand).Index;
- if (index == -1 && instruction.Operand == self.ThisParameter)
- index = 0;
- else if (method.HasThis)
- index++;
- if (index < 256)
- ExpandMacro (instruction, OpCodes.Ldarga_S, instruction.Operand);
- break;
- case Code.Ldloca:
- if (((VariableDefinition) instruction.Operand).Index < 256)
- ExpandMacro (instruction, OpCodes.Ldloca_S, instruction.Operand);
- break;
- case Code.Ldc_I4:
- int i = (int) instruction.Operand;
- switch (i) {
- case -1:
- MakeMacro (instruction, OpCodes.Ldc_I4_M1);
- break;
- case 0:
- MakeMacro (instruction, OpCodes.Ldc_I4_0);
- break;
- case 1:
- MakeMacro (instruction, OpCodes.Ldc_I4_1);
- break;
- case 2:
- MakeMacro (instruction, OpCodes.Ldc_I4_2);
- break;
- case 3:
- MakeMacro (instruction, OpCodes.Ldc_I4_3);
- break;
- case 4:
- MakeMacro (instruction, OpCodes.Ldc_I4_4);
- break;
- case 5:
- MakeMacro (instruction, OpCodes.Ldc_I4_5);
- break;
- case 6:
- MakeMacro (instruction, OpCodes.Ldc_I4_6);
- break;
- case 7:
- MakeMacro (instruction, OpCodes.Ldc_I4_7);
- break;
- case 8:
- MakeMacro (instruction, OpCodes.Ldc_I4_8);
- break;
- default:
- if (i >= -128 && i < 128)
- ExpandMacro (instruction, OpCodes.Ldc_I4_S, (sbyte) i);
- break;
- }
- break;
- }
- }
-
- OptimizeBranches (self);
- }
-
- static void OptimizeBranches (MethodBody body)
- {
- ComputeOffsets (body);
-
- foreach (var instruction in body.Instructions) {
- if (instruction.OpCode.OperandType != OperandType.InlineBrTarget)
- continue;
-
- if (OptimizeBranch (instruction))
- ComputeOffsets (body);
- }
- }
-
- static bool OptimizeBranch (Instruction instruction)
- {
- var offset = ((Instruction) instruction.Operand).Offset - (instruction.Offset + instruction.OpCode.Size + 4);
- if (!(offset >= -128 && offset <= 127))
- return false;
-
- switch (instruction.OpCode.Code) {
- case Code.Br:
- instruction.OpCode = OpCodes.Br_S;
- break;
- case Code.Brfalse:
- instruction.OpCode = OpCodes.Brfalse_S;
- break;
- case Code.Brtrue:
- instruction.OpCode = OpCodes.Brtrue_S;
- break;
- case Code.Beq:
- instruction.OpCode = OpCodes.Beq_S;
- break;
- case Code.Bge:
- instruction.OpCode = OpCodes.Bge_S;
- break;
- case Code.Bgt:
- instruction.OpCode = OpCodes.Bgt_S;
- break;
- case Code.Ble:
- instruction.OpCode = OpCodes.Ble_S;
- break;
- case Code.Blt:
- instruction.OpCode = OpCodes.Blt_S;
- break;
- case Code.Bne_Un:
- instruction.OpCode = OpCodes.Bne_Un_S;
- break;
- case Code.Bge_Un:
- instruction.OpCode = OpCodes.Bge_Un_S;
- break;
- case Code.Bgt_Un:
- instruction.OpCode = OpCodes.Bgt_Un_S;
- break;
- case Code.Ble_Un:
- instruction.OpCode = OpCodes.Ble_Un_S;
- break;
- case Code.Blt_Un:
- instruction.OpCode = OpCodes.Blt_Un_S;
- break;
- case Code.Leave:
- instruction.OpCode = OpCodes.Leave_S;
- break;
- }
-
- return true;
- }
-
- static void ComputeOffsets (MethodBody body)
- {
- var offset = 0;
- foreach (var instruction in body.Instructions) {
- instruction.Offset = offset;
- offset += instruction.GetSize ();
- }
- }
-
- public static ParameterDefinition GetParameter (this MethodBody self, int index)
- {
- var method = self.Method;
-
- if (method.HasThis) {
- if (index == 0)
- return self.ThisParameter;
-
- index--;
- }
-
- var parameters = method.Parameters;
-
- if (index < 0 || index >= parameters.Count)
- return null;
-
- return parameters [index];
- }
-
- public static bool Implements (this TypeReference self, string interfaceName)
- {
- if (interfaceName == null)
- throw new ArgumentNullException ("interfaceName");
- if (self == null)
- return false;
-
- TypeDefinition type = self.Resolve ();
- if (type == null)
- return false; // not enough information available
-
- // special case, check if we implement ourselves
- if (type.IsInterface && (type.FullName == interfaceName))
- return true;
-
- return Implements (type, interfaceName, (interfaceName.IndexOf ('`') >= 0));
- }
-
- public static bool Implements (TypeDefinition type, string interfaceName, bool generic)
- {
- while (type != null) {
- // does the type implements it itself
- if (type.HasInterfaces) {
- foreach (var iface in type.Interfaces) {
- string fullname = (generic) ? iface.InterfaceType.GetElementType ().FullName : iface.InterfaceType.FullName;
- if (fullname == interfaceName)
- return true;
- //if not, then maybe one of its parent interfaces does
- if (Implements (iface.InterfaceType.Resolve (), interfaceName, generic))
- return true;
- }
- }
-
- type = type.BaseType != null ? type.BaseType.Resolve () : null;
- }
- return false;
- }
-
- public static bool Inherits (this TypeReference self, string @namespace, string name)
- {
- if (@namespace == null)
- throw new ArgumentNullException ("namespace");
- if (name == null)
- throw new ArgumentNullException ("name");
- if (self == null)
- return false;
-
- TypeReference current = self.Resolve ();
- while (current != null) {
- if (current.Is (@namespace, name))
- return true;
- if (current.Is ("System", "Object"))
- return false;
-
- TypeDefinition td = current.Resolve ();
- if (td == null)
- return false; // could not resolve type
- current = td.BaseType;
- }
- return false;
- }
- }
-}
+++ /dev/null
-//
-// CheckVisibility.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Text;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
- public class CheckVisibility : BaseStep {
-
- bool throw_on_error;
-
- protected override void Process ()
- {
- throw_on_error = GetThrowOnVisibilityErrorParameter ();
- }
-
- bool GetThrowOnVisibilityErrorParameter ()
- {
- try {
- return bool.Parse (Context.GetParameter ("throw_on_visibility_error"));
- } catch {
- return false;
- }
- }
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (assembly.Name.Name == "mscorlib" || assembly.Name.Name == "smcs")
- return;
-
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- Report ("in assembly {0}", assembly.Name);
-
- foreach (ModuleDefinition module in assembly.Modules)
- foreach (TypeDefinition type in module.Types)
- CheckType (type);
- }
-
- void CheckType (TypeDefinition type)
- {
- if (!IsVisibleFrom (type, type.BaseType)) {
- ReportError ("Base type `{0}` of type `{1}` is not visible",
- type.BaseType, type);
- }
-
- CheckInterfaces (type);
-
- CheckFields (type);
- CheckMethods (type);
- }
-
- void CheckInterfaces (TypeDefinition type)
- {
- foreach (var iface in type.Interfaces) {
- if (!IsVisibleFrom (type, iface.InterfaceType)) {
- ReportError ("Interface `{0}` implemented by `{1}` is not visible",
- iface, type);
- }
- }
- }
-
- static bool IsPublic (TypeDefinition type)
- {
- return (type.DeclaringType == null && type.IsPublic) || type.IsNestedPublic;
- }
-
- static bool AreInDifferentAssemblies (TypeDefinition type, TypeDefinition target)
- {
- if (type.Module.Assembly.Name.FullName == target.Module.Assembly.Name.FullName)
- return false;
-
- return !IsInternalVisibleTo (target.Module.Assembly, type.Module.Assembly);
- }
-
- static bool IsInternalVisibleTo (AssemblyDefinition assembly, AssemblyDefinition candidate)
- {
- foreach (CustomAttribute attribute in assembly.CustomAttributes) {
- if (!IsInternalsVisibleToAttribute (attribute))
- continue;
-
- if (attribute.ConstructorArguments.Count == 0)
- continue;
-
- string signature = (string) attribute.ConstructorArguments [0].Value;
-
- if (InternalsVisibleToSignatureMatch (signature, candidate.Name))
- return true;
- }
-
- return false;
- }
-
- static bool InternalsVisibleToSignatureMatch (string signature, AssemblyNameReference reference)
- {
- int pos = signature.IndexOf (",");
- if (pos == -1)
- return signature == reference.Name;
-
- string assembly_name = signature.Substring (0, pos);
-
- pos = signature.IndexOf ("=");
- if (pos == -1)
- throw new ArgumentException ();
-
- string public_key = signature.Substring (pos + 1).ToLower ();
-
- return assembly_name == reference.Name && public_key == ToPublicKeyString (reference.PublicKey);
- }
-
- static string ToPublicKeyString (byte [] public_key)
- {
- StringBuilder signature = new StringBuilder (public_key.Length);
- for (int i = 0; i < public_key.Length; i++)
- signature.Append (public_key [i].ToString ("x2"));
-
- return signature.ToString ();
- }
-
- static bool IsInternalsVisibleToAttribute (CustomAttribute attribute)
- {
- return attribute.Constructor.DeclaringType.FullName == "System.Runtime.CompilerServices.InternalsVisibleToAttribute";
- }
-
- bool IsVisibleFrom (TypeDefinition type, TypeReference reference)
- {
- if (reference == null)
- return true;
-
- if (reference is GenericParameter || reference.GetElementType () is GenericParameter)
- return true;
-
- TypeDefinition other = reference.Resolve ();
- if (other == null)
- return true;
-
- if (!AreInDifferentAssemblies (type, other))
- return true;
-
- if (IsPublic (other))
- return true;
-
- return false;
- }
-
- bool IsVisibleFrom (TypeDefinition type, MethodReference reference)
- {
- if (reference == null)
- return true;
-
- MethodDefinition meth = reference.Resolve ();
- if (meth == null)
- return true;
-
- TypeDefinition dec = (TypeDefinition) meth.DeclaringType;
- if (!IsVisibleFrom (type, dec))
- return false;
-
- if (meth.IsPublic)
- return true;
-
- if (type == dec || IsNestedIn (type, dec))
- return true;
-
- if (meth.IsFamily && InHierarchy (type, dec))
- return true;
-
- if (meth.IsFamilyOrAssembly && (!AreInDifferentAssemblies (type, dec) || InHierarchy (type, dec)))
- return true;
-
- if (meth.IsFamilyAndAssembly && (!AreInDifferentAssemblies (type, dec) && InHierarchy (type, dec)))
- return true;
-
- if (!AreInDifferentAssemblies (type, dec) && meth.IsAssembly)
- return true;
-
- return false;
- }
-
- bool IsVisibleFrom (TypeDefinition type, FieldReference reference)
- {
- if (reference == null)
- return true;
-
- FieldDefinition field = reference.Resolve ();
- if (field == null)
- return true;
-
- TypeDefinition dec = (TypeDefinition) field.DeclaringType;
- if (!IsVisibleFrom (type, dec))
- return false;
-
- if (field.IsPublic)
- return true;
-
- if (type == dec || IsNestedIn (type, dec))
- return true;
-
- if (field.IsFamily && InHierarchy (type, dec))
- return true;
-
- if (field.IsFamilyOrAssembly && (!AreInDifferentAssemblies (type, dec) || InHierarchy (type, dec)))
- return true;
-
- if (field.IsFamilyAndAssembly && (!AreInDifferentAssemblies (type, dec) && InHierarchy (type, dec)))
- return true;
-
- if (!AreInDifferentAssemblies (type, dec) && field.IsAssembly)
- return true;
-
- return false;
- }
-
- static bool IsNestedIn (TypeDefinition type, TypeDefinition other)
- {
- TypeDefinition declaring = type.DeclaringType;
-
- if (declaring == null)
- return false;
-
- if (declaring == other)
- return true;
-
- if (declaring.DeclaringType == null)
- return false;
-
- return IsNestedIn (declaring, other);
- }
-
- static bool InHierarchy (TypeDefinition type, TypeDefinition other)
- {
- if (type.BaseType == null)
- return false;
-
- TypeDefinition baseType = type.BaseType.Resolve ();
-
- if (baseType == other)
- return true;
-
- return InHierarchy (baseType, other);
- }
-
- static void Report (string pattern, params object [] parameters)
- {
- Console.WriteLine ("[check] " + pattern, parameters);
- }
-
- void ReportError (string pattern, params object [] parameters)
- {
- Report (pattern, parameters);
-
- if (throw_on_error)
- throw new VisibilityErrorException (string.Format (pattern, parameters));
- }
-
- void CheckFields (TypeDefinition type)
- {
- foreach (FieldDefinition field in type.Fields) {
- if (!IsVisibleFrom (type, field.FieldType)) {
- ReportError ("Field `{0}` of type `{1}` is not visible from `{2}`",
- field.Name, field.FieldType, type);
- }
- }
- }
-
- void CheckMethods (TypeDefinition type)
- {
- CheckMethods (type, type.Methods);
- }
-
- void CheckMethods (TypeDefinition type, ICollection methods)
- {
- foreach (MethodDefinition method in methods) {
- if (!IsVisibleFrom (type, method.ReturnType)) {
- ReportError ("Method return type `{0}` in method `{1}` is not visible",
- method.ReturnType, method);
- }
-
- foreach (ParameterDefinition parameter in method.Parameters) {
- if (!IsVisibleFrom (type, parameter.ParameterType)) {
- ReportError ("Parameter `{0}` of type `{1}` in method `{2}` is not visible.",
- parameter.Index, parameter.ParameterType, method);
- }
- }
-
- if (method.HasBody)
- CheckBody (method);
- }
- }
-
- void CheckBody (MethodDefinition method)
- {
- TypeDefinition type = (TypeDefinition) method.DeclaringType;
-
- foreach (VariableDefinition variable in method.Body.Variables) {
- if (!IsVisibleFrom ((TypeDefinition) method.DeclaringType, variable.VariableType)) {
- ReportError ("Variable `{0}` of type `{1}` from method `{2}` is not visible",
- variable.Index, variable.VariableType, method);
- }
- }
-
- foreach (Instruction instr in method.Body.Instructions) {
- switch (instr.OpCode.OperandType) {
- case OperandType.InlineType:
- case OperandType.InlineMethod:
- case OperandType.InlineField:
- case OperandType.InlineTok:
- bool error = false;
- TypeReference type_ref = instr.Operand as TypeReference;
- if (type_ref != null)
- error = !IsVisibleFrom (type, type_ref);
-
- MethodReference meth_ref = instr.Operand as MethodReference;
- if (meth_ref != null)
- error = !IsVisibleFrom (type, meth_ref);
-
- FieldReference field_ref = instr.Operand as FieldReference;
- if (field_ref != null)
- error = !IsVisibleFrom (type, field_ref);
-
- if (error) {
- ReportError ("Operand `{0}` of type {1} at offset 0x{2} in method `{3}` is not visible",
- instr.Operand, instr.OpCode.OperandType, instr.Offset.ToString ("x4"), method);
- }
-
- break;
- default:
- continue;
- }
- }
- }
-
- class VisibilityErrorException : Exception {
-
- public VisibilityErrorException (string message)
- : base (message)
- {
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
- public class CustomizeActions : BaseStep {
-
- readonly bool link_sdk_only;
- readonly HashSet<string> skipped_assemblies;
-
- public CustomizeActions (bool link_sdk_only, IEnumerable<string> skipped_assemblies)
- {
- this.link_sdk_only = link_sdk_only;
- this.skipped_assemblies = new HashSet<string> (skipped_assemblies);
- }
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (!IsSkipped (assembly) && IsLinked (assembly)) {
- if (!Annotations.HasAction (assembly)) // stray assembly not picked up when resolving references
- Annotations.SetAction (assembly, AssemblyAction.Link);
- return;
- }
- ProcessUserAssembly (assembly);
- }
-
- protected virtual bool IsPreservedAttribute (CustomAttribute attribute)
- {
- // [assembly: Preserve (type)] does not preserve all the code in the assembly, in fact it might
- // not preserve anything in _this_ assembly, but something in a separate assembly (reference)
- if (attribute.HasConstructorArguments)
- return false;
- return (attribute.AttributeType.Name == "PreserveAttribute");
- }
-
- protected virtual bool IsLinkerSafeAttribute (CustomAttribute attribute)
- {
- return (attribute.AttributeType.Name == "LinkerSafeAttribute");
- }
-
- const ModuleAttributes Supported = ModuleAttributes.ILOnly | ModuleAttributes.Required32Bit |
- ModuleAttributes.Preferred32Bit | ModuleAttributes.StrongNameSigned;
-
- protected virtual bool IsSkipped (AssemblyDefinition assembly)
- {
- // Cecil can't save back mixed-mode assemblies - so we can't link them
- if ((assembly.MainModule.Attributes & ~Supported) != 0)
- return true;
-
- if (assembly.HasCustomAttributes) {
- foreach (var ca in assembly.CustomAttributes) {
- if (IsPreservedAttribute (ca))
- return true;
- }
- }
- return skipped_assemblies.Contains (assembly.Name.Name);
- }
-
- protected virtual bool IsLinked (AssemblyDefinition assembly)
- {
- // LinkAll
- if (!link_sdk_only)
- return true;
- // Link SDK : applies to BCL/SDK and product assembly (e.g. monotouch.dll)
- if (Profile.IsSdkAssembly (assembly))
- return true;
- if (Profile.IsProductAssembly (assembly))
- return true;
- // the assembly can be marked with [LinkAssembly]
- if (assembly.HasCustomAttributes) {
- foreach (var ca in assembly.CustomAttributes) {
- if (IsLinkerSafeAttribute (ca))
- return true;
- }
- }
- return false;
- }
-
- protected void ProcessUserAssembly (AssemblyDefinition assembly)
- {
- ResolveFromAssemblyStep.ProcessLibrary (Context, assembly);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- [Flags]
- public enum SubStepTargets {
- None = 0,
-
- Assembly = 1,
- Type = 2,
- Field = 4,
- Method = 8,
- Property = 16,
- Event = 32,
- }
-
- public interface ISubStep {
-
- SubStepTargets Targets { get; }
-
- void Initialize (LinkContext context);
- bool IsActiveFor (AssemblyDefinition assembly);
-
- void ProcessAssembly (AssemblyDefinition assembly);
- void ProcessType (TypeDefinition type);
- void ProcessField (FieldDefinition field);
- void ProcessMethod (MethodDefinition method);
- void ProcessProperty (PropertyDefinition property);
- void ProcessEvent (EventDefinition @event);
- }
-
- public abstract class BaseSubStep : ISubStep {
-
- protected LinkContext context;
-
- public AnnotationStore Annotations {
- get { return context.Annotations; }
- }
-
- public abstract SubStepTargets Targets { get; }
-
- public virtual void Initialize (LinkContext context)
- {
- this.context = context;
- }
-
- public virtual bool IsActiveFor (AssemblyDefinition assembly)
- {
- return true;
- }
-
- public virtual void ProcessAssembly (AssemblyDefinition assembly)
- {
- }
-
- public virtual void ProcessType (TypeDefinition type)
- {
- }
-
- public virtual void ProcessField (FieldDefinition field)
- {
- }
-
- public virtual void ProcessMethod (MethodDefinition method)
- {
- }
-
- public virtual void ProcessProperty (PropertyDefinition property)
- {
- }
-
- public virtual void ProcessEvent (EventDefinition @event)
- {
- }
- }
-
- public class SubStepDispatcher : IStep, IEnumerable<ISubStep> {
-
- List<ISubStep> substeps = new List<ISubStep> ();
-
- List<ISubStep> on_assemblies;
- List<ISubStep> on_types;
- List<ISubStep> on_fields;
- List<ISubStep> on_methods;
- List<ISubStep> on_properties;
- List<ISubStep> on_events;
-
- public void Add (ISubStep substep)
- {
- substeps.Add (substep);
- }
-
- public void Process (LinkContext context)
- {
- InitializeSubSteps (context);
-
- BrowseAssemblies (context.GetAssemblies ());
- }
-
- static bool HasSubSteps (List<ISubStep> substeps)
- {
- return substeps != null && substeps.Count > 0;
- }
-
- void BrowseAssemblies (IEnumerable<AssemblyDefinition> assemblies)
- {
- foreach (var assembly in assemblies) {
- CategorizeSubSteps (assembly);
-
- if (HasSubSteps (on_assemblies))
- DispatchAssembly (assembly);
-
- if (!ShouldDispatchTypes ())
- continue;
-
- BrowseTypes (assembly.MainModule.Types);
- }
- }
-
- bool ShouldDispatchTypes ()
- {
- return HasSubSteps (on_types)
- || HasSubSteps (on_fields)
- || HasSubSteps (on_methods)
- || HasSubSteps (on_properties)
- || HasSubSteps (on_events);
- }
-
- void BrowseTypes (ICollection types)
- {
- foreach (TypeDefinition type in types) {
- DispatchType (type);
-
- if (type.HasFields && HasSubSteps (on_fields))
- BrowseFields (type.Fields);
-
- if (type.HasMethods && HasSubSteps (on_methods))
- BrowseMethods (type.Methods);
-
- if (type.HasProperties && HasSubSteps (on_properties))
- BrowseProperties (type.Properties);
-
- if (type.HasEvents && HasSubSteps (on_events))
- BrowseEvents (type.Events);
-
- if (type.HasNestedTypes)
- BrowseTypes (type.NestedTypes);
- }
- }
-
- void BrowseFields (ICollection fields)
- {
- foreach (FieldDefinition field in fields)
- DispatchField (field);
- }
-
- void BrowseMethods (ICollection methods)
- {
- foreach (MethodDefinition method in methods)
- DispatchMethod (method);
- }
-
- void BrowseProperties (ICollection properties)
- {
- foreach (PropertyDefinition property in properties)
- DispatchProperty (property);
- }
-
- void BrowseEvents (ICollection events)
- {
- foreach (EventDefinition @event in events)
- DispatchEvent (@event);
- }
-
- void DispatchAssembly (AssemblyDefinition assembly)
- {
- foreach (var substep in on_assemblies) {
- var bs = substep as BaseSubStep;
- if (bs != null)
- bs.Annotations.Push (substep);
- substep.ProcessAssembly (assembly);
- if (bs != null)
- bs.Annotations.Pop ();
- }
- }
-
- void DispatchType (TypeDefinition type)
- {
- foreach (var substep in on_types) {
- var bs = substep as BaseSubStep;
- if (bs != null)
- bs.Annotations.Push (substep);
- substep.ProcessType (type);
- if (bs != null)
- bs.Annotations.Pop ();
- }
- }
-
- void DispatchField (FieldDefinition field)
- {
- foreach (var substep in on_fields)
- substep.ProcessField (field);
- }
-
- void DispatchMethod (MethodDefinition method)
- {
- foreach (var substep in on_methods)
- substep.ProcessMethod (method);
- }
-
- void DispatchProperty (PropertyDefinition property)
- {
- foreach (var substep in on_properties)
- substep.ProcessProperty (property);
- }
-
- void DispatchEvent (EventDefinition @event)
- {
- foreach (var substep in on_events)
- substep.ProcessEvent (@event);
- }
-
- void InitializeSubSteps (LinkContext context)
- {
- foreach (var substep in substeps)
- substep.Initialize (context);
- }
-
- void CategorizeSubSteps (AssemblyDefinition assembly)
- {
- on_assemblies = null;
- on_types = null;
- on_fields = null;
- on_methods = null;
- on_properties = null;
- on_events = null;
-
- foreach (var substep in substeps)
- CategorizeSubStep (substep, assembly);
- }
-
- void CategorizeSubStep (ISubStep substep, AssemblyDefinition assembly)
- {
- if (!substep.IsActiveFor (assembly))
- return;
-
- CategorizeTarget (substep, SubStepTargets.Assembly, ref on_assemblies);
- CategorizeTarget (substep, SubStepTargets.Type, ref on_types);
- CategorizeTarget (substep, SubStepTargets.Field, ref on_fields);
- CategorizeTarget (substep, SubStepTargets.Method, ref on_methods);
- CategorizeTarget (substep, SubStepTargets.Property, ref on_properties);
- CategorizeTarget (substep, SubStepTargets.Event, ref on_events);
- }
-
- static void CategorizeTarget (ISubStep substep, SubStepTargets target, ref List<ISubStep> list)
- {
- if (!Targets (substep, target))
- return;
-
- if (list == null)
- list = new List<ISubStep> ();
-
- list.Add (substep);
- }
-
- static bool Targets (ISubStep substep, SubStepTargets target)
- {
- return (substep.Targets & target) == target;
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- public IEnumerator<ISubStep> GetEnumerator ()
- {
- return substeps.GetEnumerator ();
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
- public static partial class Extensions {
-
- public static bool TryGetLinkedAssembly (this LinkContext context, string name, out AssemblyDefinition assembly)
- {
- assembly = GetAssembly (context, name);
- if (assembly == null)
- return false;
-
- return context.Annotations.GetAction (assembly) == AssemblyAction.Link;
- }
-
- public static AssemblyDefinition GetAssembly (this LinkContext context, string assembly_name)
- {
- foreach (var assembly in context.GetAssemblies ())
- if (assembly.Name.Name == assembly_name)
- return assembly;
-
- return null;
- }
-
- // note: direct check, no inheritance
- public static bool Is (this TypeReference type, string @namespace, string name)
- {
- return ((type != null) && (type.Name == name) && (type.Namespace == @namespace));
- }
- }
-}
+++ /dev/null
-//
-// FilterAttributes.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class FilterAttributes : BaseStep {
-
- static Hashtable attributes = new Hashtable ();
-
- static FilterAttributes ()
- {
- FilterAttribute ("System.Runtime.InteropServices.ComVisibleAttribute");
- }
-
- static void FilterAttribute (string fullname)
- {
- attributes.Add (fullname, null);
- }
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- Filter (assembly);
-
- foreach (ModuleDefinition module in assembly.Modules)
- ProcessModule (module);
- }
-
- static void ProcessModule (ModuleDefinition module)
- {
- Filter (module);
-
- foreach (TypeDefinition type in module.Types)
- ProcessType (type);
- }
-
- static void ProcessType (TypeDefinition type)
- {
- if (type.HasFields)
- ProcessFields (type.Fields);
-
- if (type.HasMethods)
- ProcessMethods (type.Methods);
-
- if (type.HasEvents)
- ProcessEvents (type.Events);
-
- if (type.HasProperties)
- ProcessProperties (type.Properties);
-
- ProcessGenericParameters (type);
- }
-
- static void ProcessFields (ICollection fields)
- {
- foreach (FieldDefinition field in fields)
- Filter (field);
- }
-
- static void ProcessMethods (ICollection methods)
- {
- foreach (MethodDefinition method in methods)
- ProcessMethod (method);
- }
-
- static void ProcessMethod (MethodDefinition method)
- {
- ProcessGenericParameters (method);
-
- Filter (method.MethodReturnType);
-
- if (method.HasParameters)
- ProcessParameters (method.Parameters);
- }
-
- static void ProcessParameters (ICollection parameters)
- {
- foreach (ParameterDefinition parameter in parameters)
- Filter (parameter);
- }
-
- static void ProcessGenericParameters (IGenericParameterProvider provider)
- {
- if (!provider.HasGenericParameters)
- return;
-
- foreach (GenericParameter parameter in provider.GenericParameters)
- Filter (parameter);
- }
-
- static void ProcessEvents (ICollection events)
- {
- foreach (EventDefinition @event in events)
- Filter (@event);
- }
-
- static void ProcessProperties (ICollection properties)
- {
- foreach (PropertyDefinition property in properties)
- Filter (property);
- }
-
- static void Filter (ICustomAttributeProvider provider)
- {
- if (!provider.HasCustomAttributes)
- return;
-
- for (int i = 0; i < provider.CustomAttributes.Count; i++) {
- CustomAttribute attribute = provider.CustomAttributes [i];
- if (!IsFilteredAttribute (attribute))
- continue;
-
- provider.CustomAttributes.RemoveAt (i--);
- }
- }
-
- static bool IsFilteredAttribute (CustomAttribute attribute)
- {
- return attributes.Contains (attribute.Constructor.DeclaringType.FullName);
- }
- }
-}
+++ /dev/null
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class FixModuleFlags : BaseStep {
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- assembly.MainModule.Attributes = ModuleAttributes.ILOnly;
- }
- }
-}
+++ /dev/null
-//
-// InjectSecurityAttributes.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-using System.Linq;
-using System.Text;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
- public class InjectSecurityAttributes : BaseStep {
-
- enum TargetKind {
- Type,
- Method,
- }
-
- protected enum AttributeType {
- Critical,
- SafeCritical,
- }
-
- const string _safe_critical = "System.Security.SecuritySafeCriticalAttribute";
- const string _critical = "System.Security.SecurityCriticalAttribute";
- const string _system_void = "System.Void";
-
- const string sec_attr_folder = "secattrs";
-
- protected AssemblyDefinition _assembly;
-
- MethodDefinition _safe_critical_ctor;
- MethodDefinition _critical_ctor;
- TypeDefinition _void_type;
-
- string data_folder;
-
- protected override bool ConditionToProcess ()
- {
- if (!Context.HasParameter (sec_attr_folder)) {
- Console.Error.WriteLine ("Warning: no secattrs folder specified.");
- return false;
- }
-
- data_folder = Context.GetParameter (sec_attr_folder);
- return true;
- }
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- string secattr_file = Path.Combine (
- data_folder,
- assembly.Name.Name + ".secattr");
-
- if (!File.Exists (secattr_file)) {
- Console.Error.WriteLine ("Warning: file '{0}' not found, skipping.", secattr_file);
- return;
- }
-
- _assembly = assembly;
-
- // remove existing [SecurityCritical] and [SecuritySafeCritical]
- RemoveSecurityAttributes ();
-
- // add [SecurityCritical] and [SecuritySafeCritical] from the data file
- ProcessSecurityAttributeFile (secattr_file);
- }
-
- protected void RemoveSecurityAttributes ()
- {
- foreach (TypeDefinition type in _assembly.MainModule.Types) {
- if (RemoveSecurityAttributes (type))
- type.HasSecurity = false;
-
- if (type.HasMethods) {
- foreach (MethodDefinition method in type.Methods) {
- if (RemoveSecurityAttributes (method))
- method.HasSecurity = false;
- }
- }
- }
- }
-
- static bool RemoveSecurityDeclarations (ISecurityDeclarationProvider provider)
- {
- // also remove already existing CAS security declarations
-
- if (provider == null)
- return false;
-
- if (!provider.HasSecurityDeclarations)
- return false;
-
- provider.SecurityDeclarations.Clear ();
- return true;
- }
-
- static bool RemoveSecurityAttributes (ICustomAttributeProvider provider)
- {
- bool result = RemoveSecurityDeclarations (provider as ISecurityDeclarationProvider);
-
- if (!provider.HasCustomAttributes)
- return result;
-
- var attributes = provider.CustomAttributes;
- for (int i = 0; i < attributes.Count; i++) {
- CustomAttribute attribute = attributes [i];
- switch (attribute.Constructor.DeclaringType.FullName) {
- case _safe_critical:
- case _critical:
- attributes.RemoveAt (i--);
- break;
- }
- }
- return result;
- }
-
- void ProcessSecurityAttributeFile (string file)
- {
- using (StreamReader reader = File.OpenText (file)) {
- string line;
- while ((line = reader.ReadLine ()) != null)
- ProcessLine (line);
- }
- }
-
- void ProcessLine (string line)
- {
- if (line == null || line.Length < 6 || line [0] == '#')
- return;
-
- int sep = line.IndexOf (": ");
- if (sep == -1)
- return;
-
- string marker = line.Substring (0, sep);
- string target = line.Substring (sep + 2);
-
- ProcessSecurityAttributeEntry (
- DecomposeAttributeType (marker),
- DecomposeTargetKind (marker),
- target);
- }
-
- static AttributeType DecomposeAttributeType (string marker)
- {
- if (marker.StartsWith ("SC"))
- return AttributeType.Critical;
- else if (marker.StartsWith ("SSC"))
- return AttributeType.SafeCritical;
- else
- throw new ArgumentException ();
- }
-
- static TargetKind DecomposeTargetKind (string marker)
- {
- switch (marker [marker.Length - 1]) {
- case 'T':
- return TargetKind.Type;
- case 'M':
- return TargetKind.Method;
- default:
- throw new ArgumentException ();
- }
- }
-
- public static bool NeedsDefaultConstructor (TypeDefinition type)
- {
- if (type.IsInterface)
- return false;
-
- TypeReference base_type = type.BaseType;
- if ((base_type == null) || (base_type.Namespace != "System"))
- return true;
-
- return ((base_type.Name != "Delegate") && (base_type.Name != "MulticastDelegate"));
- }
-
- void ProcessSecurityAttributeEntry (AttributeType type, TargetKind kind, string target)
- {
- ICustomAttributeProvider provider = GetTarget (kind, target);
- if (provider == null) {
- Console.Error.WriteLine ("Warning: entry '{0}' could not be found", target);
- return;
- }
-
- // we need to be smarter when applying the attributes (mostly SC) to types
- if (kind == TargetKind.Type) {
- TypeDefinition td = (provider as TypeDefinition);
- // ensure [SecurityCritical] types (well most) have a default constructor
- if ((type == AttributeType.Critical) && NeedsDefaultConstructor (td)) {
- if (GetDefaultConstructor (td) == null) {
- // Console.Error.WriteLine ("Info: adding default ctor for '{0}'", td);
- td.Methods.Add (CreateDefaultConstructor ());
- }
- }
-
- // it's easier for some tools (e.g. less false positives in fxcop)
- // and also quicker for the runtime (one less lookup) if all methods gets decorated
- foreach (MethodDefinition method in td.Methods) {
- bool skip = false;
-
- AttributeType mtype = type;
- // there are cases where an SC cannot be applied to some methods
- switch (method.Name) {
- // e.g. everything we override from System.Object (which is transparent)
- case "Equals":
- skip = method.Parameters.Count == 1 && method.Parameters [0].ParameterType.FullName == "System.Object";
- break;
- case "Finalize":
- case "GetHashCode":
- case "ToString":
- skip = !method.HasParameters;
- break;
- // e.g. some transparent interfaces, like IDisposable (implicit or explicit)
- // downgrade some SC into SSC to respect the override/inheritance rules
- case "System.IDisposable.Dispose":
- case "Dispose":
- skip = !method.HasParameters;
- break;
- }
-
- if (skip)
- continue;
-
- switch (mtype) {
- case AttributeType.Critical:
- AddCriticalAttribute (method);
- break;
- case AttributeType.SafeCritical:
- AddSafeCriticalAttribute (method);
- break;
- }
- }
- }
-
- switch (type) {
- case AttributeType.Critical:
- AddCriticalAttribute (provider);
- break;
- case AttributeType.SafeCritical:
- AddSafeCriticalAttribute (provider);
- break;
- }
- }
-
- protected void AddCriticalAttribute (ICustomAttributeProvider provider)
- {
- // a [SecurityCritical] replaces a [SecuritySafeCritical]
- if (HasSecurityAttribute (provider, AttributeType.SafeCritical))
- RemoveSecurityAttributes (provider);
-
- AddSecurityAttribute (provider, AttributeType.Critical);
- }
-
- void AddSafeCriticalAttribute (ICustomAttributeProvider provider)
- {
- // a [SecuritySafeCritical] is ignored if a [SecurityCritical] is present
- if (HasSecurityAttribute (provider, AttributeType.Critical))
- return;
-
- AddSecurityAttribute (provider, AttributeType.SafeCritical);
- }
-
- void AddSecurityAttribute (ICustomAttributeProvider provider, AttributeType type)
- {
- if (HasSecurityAttribute (provider, type))
- return;
-
- var attributes = provider.CustomAttributes;
- switch (type) {
- case AttributeType.Critical:
- attributes.Add (CreateCriticalAttribute ());
- break;
- case AttributeType.SafeCritical:
- attributes.Add (CreateSafeCriticalAttribute ());
- break;
- }
- }
-
- protected static bool HasSecurityAttribute (ICustomAttributeProvider provider, AttributeType type)
- {
- if (!provider.HasCustomAttributes)
- return false;
-
- foreach (CustomAttribute attribute in provider.CustomAttributes) {
- switch (attribute.Constructor.DeclaringType.Name) {
- case _critical:
- if (type == AttributeType.Critical)
- return true;
-
- break;
- case _safe_critical:
- if (type == AttributeType.SafeCritical)
- return true;
-
- break;
- }
- }
-
- return false;
- }
-
- ICustomAttributeProvider GetTarget (TargetKind kind, string target)
- {
- switch (kind) {
- case TargetKind.Type:
- return GetType (target);
- case TargetKind.Method:
- return GetMethod (target);
- default:
- throw new ArgumentException ();
- }
- }
-
- TypeDefinition GetType (string fullname)
- {
- return _assembly.MainModule.GetType (fullname);
- }
-
- MethodDefinition GetMethod (string signature)
- {
- int pos = signature.IndexOf (" ");
- if (pos == -1)
- throw new ArgumentException ();
-
- string tmp = signature.Substring (pos + 1);
-
- pos = tmp.IndexOf ("::");
- if (pos == -1)
- throw new ArgumentException ();
-
- string type_name = tmp.Substring (0, pos);
-
- int parpos = tmp.IndexOf ("(");
- if (parpos == -1)
- throw new ArgumentException ();
-
- string method_name = tmp.Substring (pos + 2, parpos - pos - 2);
-
- TypeDefinition type = GetType (type_name);
- if (type == null)
- return null;
-
- return GetMethod (type.Methods, signature);
- }
-
- static MethodDefinition GetMethod (IEnumerable methods, string signature)
- {
- foreach (MethodDefinition method in methods)
- if (GetFullName (method) == signature)
- return method;
-
- return null;
- }
-
- static string GetFullName (MethodReference method)
- {
- var sentinel = method.Parameters.FirstOrDefault (p => p.ParameterType.IsSentinel);
- var sentinel_pos = -1;
- if (sentinel != null)
- sentinel_pos = method.Parameters.IndexOf (sentinel);
-
- StringBuilder sb = new StringBuilder ();
- sb.Append (method.ReturnType.FullName);
- sb.Append (" ");
- sb.Append (method.DeclaringType.FullName);
- sb.Append ("::");
- sb.Append (method.Name);
- if (method.HasGenericParameters) {
- sb.Append ("<");
- for (int i = 0; i < method.GenericParameters.Count; i++ ) {
- if (i > 0)
- sb.Append (",");
- sb.Append (method.GenericParameters [i].Name);
- }
- sb.Append (">");
- }
- sb.Append ("(");
- if (method.HasParameters) {
- for (int i = 0; i < method.Parameters.Count; i++) {
- if (i > 0)
- sb.Append (",");
-
- if (i == sentinel_pos)
- sb.Append ("...,");
-
- sb.Append (method.Parameters [i].ParameterType.FullName);
- }
- }
- sb.Append (")");
- return sb.ToString ();
- }
-
- static MethodDefinition GetDefaultConstructor (TypeDefinition type)
- {
- foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
- if (!ctor.IsStatic && !ctor.HasParameters)
- return ctor;
-
- return null;
- }
-
- MethodDefinition GetSafeCriticalCtor ()
- {
- if (_safe_critical_ctor != null)
- return _safe_critical_ctor;
-
- TypeDefinition safe_critical_type = Context.GetType (_safe_critical);
- if (safe_critical_type == null)
- throw new InvalidOperationException (String.Format ("{0} type not found", _safe_critical));
-
- _safe_critical_ctor = GetDefaultConstructor (safe_critical_type);
- return _safe_critical_ctor;
- }
-
- MethodDefinition GetCriticalCtor ()
- {
- if (_critical_ctor != null)
- return _critical_ctor;
-
- TypeDefinition critical_type = Context.GetType (_critical);
- if (critical_type == null)
- throw new InvalidOperationException (String.Format ("{0} type not found", _critical));
-
- _critical_ctor = GetDefaultConstructor (critical_type);
- return _critical_ctor;
- }
-
- TypeDefinition GetSystemVoid ()
- {
- if (_void_type != null)
- return _void_type;
-
- _void_type = Context.GetType (_system_void);
- if (_void_type == null)
- throw new InvalidOperationException (String.Format ("{0} type not found", _system_void));
-
- return _void_type;
- }
-
- MethodReference Import (MethodDefinition method)
- {
- return _assembly.MainModule.Import (method);
- }
-
- CustomAttribute CreateSafeCriticalAttribute ()
- {
- return new CustomAttribute (Import (GetSafeCriticalCtor ()));
- }
-
- CustomAttribute CreateCriticalAttribute ()
- {
- return new CustomAttribute (Import (GetCriticalCtor ()));
- }
-
- MethodDefinition CreateDefaultConstructor ()
- {
- MethodDefinition method = new MethodDefinition (".ctor",
- MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName,
- GetSystemVoid ());
- method.Body.Instructions.Add (Instruction.Create (OpCodes.Ret));
- return method;
- }
- }
-}
+++ /dev/null
-//
-// MarkNSObjectsBase.cs
-//
-// Authors:
-// Jb Evain (jbevain@novell.com)
-// Sebastien Pouliot <sebastien@xamarin.com>
-//
-// (C) 2009 Novell, Inc.
-// Copyright (C) 2011 Xamarin, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public abstract class MarkNSObjectsBase : BaseSubStep {
-
- protected abstract string ExportAttribute { get; }
-
- public override SubStepTargets Targets {
- get { return SubStepTargets.Type; }
- }
-
- public override void ProcessType (TypeDefinition type)
- {
- if (!IsProductType (type)) {
- Annotations.Mark (type);
- Annotations.SetPreserve (type, TypePreserve.All);
- } else
- PreserveProductType (type);
- }
-
- void PreserveProductType (TypeDefinition type)
- {
- PreserveIntPtrConstructor (type);
- PreserveExportedMethods (type);
- }
-
- void PreserveExportedMethods (TypeDefinition type)
- {
- if (!type.HasMethods)
- return;
-
- foreach (var method in type.GetMethods ()) {
- if (!IsExportedMethod (method))
- continue;
-
- if (!IsOverridenInUserCode (method))
- continue;
-
- PreserveMethod (type, method);
- }
- }
-
- bool IsOverridenInUserCode (MethodDefinition method)
- {
- if (!method.IsVirtual)
- return false;
-
- var overrides = Annotations.GetOverrides (method);
- if (overrides == null || overrides.Count == 0)
- return false;
-
- foreach (MethodDefinition @override in overrides)
- if (!IsProductMethod (@override))
- return true;
-
- return false;
- }
-
- bool IsExportedMethod (MethodDefinition method)
- {
- return HasExportAttribute (method);
- }
-
- bool HasExportAttribute (ICustomAttributeProvider provider)
- {
- if (!provider.HasCustomAttributes)
- return false;
-
- foreach (CustomAttribute attribute in provider.CustomAttributes)
- if (attribute.AttributeType.FullName == ExportAttribute)
- return true;
-
- return false;
- }
-
- void PreserveIntPtrConstructor (TypeDefinition type)
- {
- if (!type.HasMethods)
- return;
-
- foreach (MethodDefinition constructor in type.GetConstructors ()) {
- if (!constructor.HasParameters)
- continue;
-
- if (constructor.Parameters.Count != 1 || constructor.Parameters [0].ParameterType.FullName != "System.IntPtr")
- continue;
-
- PreserveMethod (type, constructor);
- break; // only one .ctor can match this
- }
- }
-
- void PreserveMethod (TypeDefinition type, MethodDefinition method)
- {
- Annotations.AddPreservedMethod (type, method);
- }
-
- static bool IsProductMethod (MethodDefinition method)
- {
- return IsProductType (method.DeclaringType);
- }
-
- static bool IsProductType (TypeDefinition type)
- {
- return Profile.IsProductAssembly (type.Module.Assembly);
- }
- }
-}
+++ /dev/null
-//
-// MoonlightA11yApiMarker.cs
-//
-// Author:
-// Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Xml;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class MoonlightA11yApiMarker : MarkStep {
-
- bool IsA11yAssembly (AssemblyDefinition assembly)
- {
- return assembly.ToString ().Contains ("DummyEntry") || assembly.ToString ().Contains ("MoonAtkBridge");
- }
-
- protected override void InitializeAssembly (AssemblyDefinition assembly)
- {
- if (IsA11yAssembly (assembly))
- base.InitializeAssembly (assembly);
- }
-
- protected override void EnqueueMethod (MethodDefinition method)
- {
- if (IsA11yAssembly (method.DeclaringType.Module.Assembly))
- base.EnqueueMethod (method);
- else
- Annotations.Mark (method);
- }
-
- protected override bool IgnoreScope (IMetadataScope scope)
- {
- return false;
- }
-
- protected override TypeDefinition MarkType (TypeReference reference)
- {
- if (reference == null)
- throw new ArgumentNullException ("reference");
-
- reference = GetOriginalType (reference);
-
- if (reference is GenericParameter)
- return null;
-
- TypeDefinition type = reference.Resolve ();
-
- if (type == null)
- throw new ResolutionException (reference);
-
- if (CheckProcessed (type))
- return type;
-
- Annotations.Mark (type);
- return type;
- }
- }
-}
+++ /dev/null
-//
-// MoonlightA11yAssemblyStep.cs
-//
-// Author:
-// Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class MoonlightA11yAssemblyStep : MoonlightAssemblyStep {
-
- protected override void CustomizePipeline (Pipeline pipeline)
- {
- pipeline.RemoveStep (typeof (LoadI18nAssemblies));
- pipeline.RemoveStep (typeof (BlacklistStep));
- pipeline.RemoveStep (typeof (MarkStep));
- pipeline.RemoveStep (typeof (SweepStep));
- pipeline.RemoveStep (typeof (CleanStep));
- pipeline.RemoveStep (typeof (RegenerateGuidStep));
- pipeline.AddStepBefore (typeof (OutputStep), new MoonlightA11yProcessor ());
- }
-
- }
-}
+++ /dev/null
-//
-// MoonlightA11yDescriptorGenerator.cs
-//
-// Author:
-// Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using System.IO;
-using System.Text.RegularExpressions;
-using System.Text;
-
-using System.Xml;
-using System.Xml.XPath;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class MoonlightA11yDescriptorGenerator : BaseStep {
-
- XmlTextWriter writer = null;
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (assembly.Name.Name == "MoonAtkBridge" || assembly.Name.Name == "System.Windows" ||
- assembly.Name.Name.Contains ("Dummy"))
- return;
-
- if (writer == null) {
- if (!Directory.Exists (Context.OutputDirectory))
- Directory.CreateDirectory (Context.OutputDirectory);
-
- string file_name = "descriptors.xml";
- string file_path = Path.Combine (Context.OutputDirectory, file_name);
- if (File.Exists (file_path))
- File.Delete (file_path);
- FileStream xml_file = new FileStream (file_path, FileMode.OpenOrCreate);
- Console.WriteLine ("Created file {0}", file_name);
- Console.Write ("Writing contents...");
-
- writer = new XmlTextWriter (xml_file, System.Text.Encoding.UTF8);
- writer.Formatting = Formatting.Indented;
- writer.WriteStartElement("linker");
- }
-
- SortedDictionary <TypeDefinition, IList> types = ScanAssembly (assembly);
- if (types != null && types.Count > 0) {
- writer.WriteStartElement("assembly");
- writer.WriteAttributeString ("fullname", assembly.Name.Name);
-
- foreach (TypeDefinition type in types.Keys) {
- IList members = types [type];
- if (members != null && members.Count > 0) {
- writer.WriteStartElement("type");
- writer.WriteAttributeString ("fullname", type.FullName);
-
- foreach (IMetadataTokenProvider member in members) {
- MethodDefinition method = member as MethodDefinition;
- if (method != null) {
- writer.WriteStartElement("method");
- writer.WriteAttributeString ("signature",
- method.ReturnType.FullName + " " +
- method.Name + GetMethodParams (method));
- writer.WriteEndElement ();
- continue;
- }
-
- FieldDefinition field = member as FieldDefinition;
- if (field != null) {
- writer.WriteStartElement("field");
- writer.WriteAttributeString ("signature", field.DeclaringType.FullName + " " + field.Name);
- writer.WriteEndElement ();
- }
- }
- writer.WriteEndElement ();
- }
- }
-
- writer.WriteEndElement ();
- Console.WriteLine ();
- }
-
- }
-
- protected override void EndProcess ()
- {
- Console.WriteLine ();
-
- foreach (FileStream stream in streams)
- stream.Close ();
-
- if (writer != null) {
- writer.WriteEndElement ();
- writer.Close ();
- writer = null;
- }
- }
-
- //this is almost the ToString method of MethodDefinition...
- private string GetMethodParams (MethodDefinition method)
- {
- string @params = "(";
- if (method.HasParameters) {
- for (int i = 0; i < method.Parameters.Count; i++) {
- if (i > 0)
- @params += ",";
-
- @params += method.Parameters [i].ParameterType.FullName;
- }
- }
- @params += ")";
- return @params;
- }
-
- SortedDictionary<TypeDefinition, IList> /*,List<IAnnotationProvider>>*/ ScanAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return null;
-
- SortedDictionary<TypeDefinition, IList> members_used = new SortedDictionary<TypeDefinition, IList> (new TypeComparer ());
- foreach (TypeDefinition type in assembly.MainModule.Types) {
- IList used_providers = FilterPublicMembers (ScanType (type));
- if (used_providers.Count > 0)
- members_used [type] = used_providers;
- else if (IsInternal (type, true) &&
- Annotations.IsMarked (type))
- throw new NotSupportedException (String.Format ("The type {0} is used while its API is not", type.ToString ()));
- }
- return members_used;
- }
-
- IList ScanType (TypeDefinition type)
- {
- return ExtractUsedProviders (type.Methods, type.Fields);
- }
-
- static IList FilterPublicMembers (IList members)
- {
- IList new_list = new ArrayList ();
- foreach (MemberReference item in members)
- if (IsInternal (item, true))
- new_list.Add (item);
-
- return new_list;
- }
-
- static string [] master_infos = Directory.GetFiles (Environment.CurrentDirectory, "*.info");
-
- static string FindMasterInfoFile (string name)
- {
- if (master_infos.Length == 0)
- throw new Exception ("No masterinfo files found in current directory");
-
- foreach (string file in master_infos) {
- if (file.EndsWith (name + ".info"))
- return file;
- }
-
- return null;
- }
-
- const string xpath_init = "assemblies/assembly/namespaces/namespace[@name='{0}']/classes/class[@name='{1}']";
-
- static string GetXPathSearchForType (TypeDefinition type)
- {
- TypeDefinition parent_type = type;
- string xpath = String.Empty;
- while (parent_type.DeclaringType != null) {
- xpath = String.Format ("/classes/class[@name='{0}']", parent_type.Name) + xpath;
- parent_type = parent_type.DeclaringType;
- }
- return String.Format (xpath_init, parent_type.Namespace, parent_type.Name) + xpath;
- }
-
- static bool IsInternal (MemberReference member, bool master_info)
- {
- TypeDefinition type = null;
- string master_info_file = null;
-
- if (member is TypeDefinition) {
- type = member as TypeDefinition;
- if (!master_info)
- return (!type.IsNested && !type.IsPublic) ||
- (type.IsNested && (!type.IsNestedPublic || IsInternal (type.DeclaringType, false)));
-
- master_info_file = FindMasterInfoFile (type.Module.Assembly.Name.Name);
- if (master_info_file == null)
- return IsInternal (member, false);
-
- return !NodeExists (master_info_file, GetXPathSearchForType (type));
- }
-
- type = member.DeclaringType.Resolve ();
-
- if (IsInternal (type, master_info))
- return true;
-
- MethodDefinition method = member as MethodDefinition;
- FieldDefinition field = member as FieldDefinition;
-
- if (field == null && method == null)
- throw new System.NotSupportedException ("Members to scan should be methods or fields");
-
- if (!master_info) {
-
- if (method != null)
- return !method.IsPublic;
-
- return !field.IsPublic;
- }
-
- master_info_file = FindMasterInfoFile (type.Module.Assembly.Name.Name);
- if (master_info_file == null)
- return IsInternal (member, false);
-
- string xpath_type = GetXPathSearchForType (type);
- string name;
- if (field != null)
- name = field.Name;
- else {
- name = method.ToString ();
-
- //lame, I know...
- name = WackyOutArgs (WackyCommas (name.Substring (name.IndexOf ("::") + 2)
- .Replace ("/", "+") // nested classes
- .Replace ('<', '[').Replace ('>', ']'))); //generic params
- }
-
- if (field != null || !IsPropertyMethod (method))
- return !NodeExists (master_info_file, xpath_type + String.Format ("/*/*[@name='{0}']", name));
-
- return !NodeExists (master_info_file, xpath_type + String.Format ("/properties/*/*/*[@name='{0}']", name));
- }
-
- //at some point I want to get rid of this method and ask cecil's maintainer to spew commas in a uniform way...
- static string WackyCommas (string method)
- {
- string outstring = String.Empty;
- bool square_bracket = false;
- foreach (char c in method) {
- if (c == '[')
- square_bracket = true;
- else if (c == ']')
- square_bracket = false;
-
- outstring = outstring + c;
-
- if (c == ',' && !square_bracket)
- outstring = outstring + " ";
- }
- return outstring;
- }
-
- //ToString() spews & but not 'out' keyword
- static string WackyOutArgs (string method)
- {
- return Regex.Replace (method, @"\w+&", delegate (Match m) { return "out " + m.ToString (); });
- }
-
- //copied from MarkStep (violating DRY unless I can put this in a better place... Cecil?)
- static bool IsPropertyMethod (MethodDefinition md)
- {
- return (md.SemanticsAttributes & MethodSemanticsAttributes.Getter) != 0 ||
- (md.SemanticsAttributes & MethodSemanticsAttributes.Setter) != 0;
- }
-
- static Dictionary<string, XPathNavigator> navs = new Dictionary<string, XPathNavigator> ();
- static List<FileStream> streams = new List<FileStream> ();
-
- static bool NodeExists (string file, string xpath)
- {
- Console.Write (".");
- //Console.WriteLine ("Looking for node {0} in file {1}", xpath, file.Substring (file.LastIndexOf ("/") + 1));
-
- XPathNavigator nav = null;
- if (!navs.TryGetValue (file, out nav)) {
- FileStream stream = new FileStream (file, FileMode.Open);
- XPathDocument document = new XPathDocument (stream);
- nav = document.CreateNavigator ();
- streams.Add (stream);
- navs [file] = nav;
- }
- return nav.SelectSingleNode (xpath) != null;
- }
-
- IList /*List<IAnnotationProvider>*/ ExtractUsedProviders (params IList[] members)
- {
- IList used = new ArrayList ();
- if (members == null || members.Length == 0)
- return used;
-
- foreach (IList members_list in members)
- foreach (IMetadataTokenProvider provider in members_list)
- if (Annotations.IsMarked (provider))
- used.Add (provider);
-
- return used;
- }
-
- class TypeComparer : IComparer <TypeDefinition> {
-
- public int Compare (TypeDefinition x, TypeDefinition y)
- {
- return string.Compare (x.ToString (), y.ToString ());
- }
-
- }
-
- }
-}
+++ /dev/null
-//
-// MoonlightA11yProcessor.cs
-//
-// Author:
-// Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using System;
-using System.Linq;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
- public class MoonlightA11yProcessor : InjectSecurityAttributes {
-
- protected override bool ConditionToProcess ()
- {
- return true;
- }
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- _assembly = assembly;
-
- // remove existing [SecurityCritical] and [SecuritySafeCritical]
- RemoveSecurityAttributes ();
-
- // add [SecurityCritical]
- AddSecurityAttributes ();
-
- // convert all public members into internal
- MakeApiInternal ();
- }
-
- void MakeApiInternal ()
- {
- foreach (TypeDefinition type in _assembly.MainModule.Types) {
- if (type.IsPublic)
- type.IsPublic = false;
-
- if (type.HasMethods && !type.Name.EndsWith ("Adapter"))
- foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
- if (ctor.IsPublic)
- ctor.IsAssembly = true;
-
- if (type.HasMethods)
- foreach (MethodDefinition method in type.Methods.Where (m => !m.IsConstructor))
- if (method.IsPublic)
- method.IsAssembly = true;
- }
- }
-
- void AddSecurityAttributes ()
- {
- foreach (TypeDefinition type in _assembly.MainModule.Types) {
- AddCriticalAttribute (type);
-
- if (type.HasMethods)
- foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
- AddCriticalAttribute (ctor);
-
- if (type.HasMethods)
- foreach (MethodDefinition method in type.Methods.Where (m => !m.IsConstructor)) {
- MethodDefinition parent = null;
-
- //TODO: take in account generic params
- if (!method.HasGenericParameters) {
-
- /*
- * we need to scan base methods because the CoreCLR complains about SC attribs added
- * to overriden methods whose base (virtual or interface) method is not marked as SC
- * with TypeLoadExceptions
- */
- parent = GetBaseMethod (type, method);
- }
-
- //if there's no base method
- if (parent == null ||
-
- //if it's our bridge assembly, we're sure it will (finally, at the end of the linking process) have the SC attrib
- _assembly.MainModule.Types.Contains (parent.DeclaringType) ||
-
- //if the type is in the moonlight assemblies, check if it has the SC attrib
- HasSecurityAttribute (parent, AttributeType.Critical))
-
- AddCriticalAttribute (method);
- }
-
- }
- }
-
- MethodDefinition GetBaseMethod (TypeDefinition finalType, MethodDefinition final)
- {
- // both GetOverridenMethod and GetInterfaceMethod return null if there is no base method
- return GetOverridenMethod (finalType, final) ?? GetInterfaceMethod (finalType, final);
- }
-
- //note: will not return abstract methods
- MethodDefinition GetOverridenMethod (TypeDefinition finalType, MethodDefinition final)
- {
- TypeReference baseType = finalType.BaseType;
- while (baseType != null && baseType.Resolve () != null) {
- foreach (MethodDefinition method in baseType.Resolve ().Methods) {
- if (!method.IsVirtual || method.Name != final.Name)
- continue;
-
- //TODO: should we discard them?
- if (method.IsAbstract)
- continue;
-
- if (HasSameSignature (method, final))
- return method;
- }
- baseType = baseType.Resolve().BaseType;
- }
- return null;
- }
-
- MethodDefinition GetInterfaceMethod (TypeDefinition finalType, MethodDefinition final)
- {
- TypeDefinition baseType = finalType;
- while (baseType != null) {
- if (baseType.HasInterfaces)
- foreach (var @interface in baseType.Interfaces)
- foreach (MethodDefinition method in @interface.InterfaceType.Resolve ().Methods)
- if (method.Name == final.Name && HasSameSignature (method, final))
- return method;
-
- baseType = baseType.BaseType == null ? null : baseType.BaseType.Resolve ();
- }
- return null;
- }
-
- bool HasSameSignature (MethodDefinition method1, MethodDefinition method2)
- {
- if (method1.ReturnType.FullName != method2.ReturnType.FullName)
- return false;
-
- if (method1.Parameters.Count != method2.Parameters.Count)
- return false;
-
- for (int i = 0; i < method1.Parameters.Count; i++) {
- if (method1.Parameters [i].ParameterType.FullName !=
- method2.Parameters [i].ParameterType.FullName)
- return false;
- }
-
- return true;
- }
- }
-}
+++ /dev/null
-//
-// MoonlightA11yUsageInspectionStep.cs
-//
-// Author:
-// Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class MoonlightA11yUsageInspectionStep : MoonlightAssemblyStep {
-
- protected override void CustomizePipeline (Pipeline pipeline)
- {
- pipeline.ReplaceStep (typeof (MarkStep), new MoonlightA11yApiMarker ());
- pipeline.ReplaceStep (typeof (SweepStep), new MoonlightA11yDescriptorGenerator ());
- pipeline.RemoveStep (typeof (LoadI18nAssemblies));
- pipeline.RemoveStep (typeof (CleanStep));
- pipeline.RemoveStep (typeof (RegenerateGuidStep));
- pipeline.RemoveStep (typeof (OutputStep));
- }
- }
-}
+++ /dev/null
-//
-// MoonlightAssemblyStep.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class MoonlightAssemblyStep : IStep {
-
- public void Process (LinkContext context)
- {
- CustomizePipeline (context.Pipeline);
- ProcessAssemblies (context);
- }
-
- static void ProcessAssemblies (LinkContext context)
- {
- foreach (AssemblyDefinition assembly in context.GetAssemblies ())
- context.Annotations.SetAction (assembly, AssemblyAction.Link);
- }
-
- protected virtual void CustomizePipeline (Pipeline pipeline)
- {
- pipeline.RemoveStep (typeof (LoadI18nAssemblies));
- pipeline.RemoveStep (typeof (BlacklistStep));
- pipeline.RemoveStep (typeof (TypeMapStep));
- pipeline.RemoveStep (typeof (MarkStep));
- pipeline.RemoveStep (typeof (SweepStep));
- pipeline.RemoveStep (typeof (CleanStep));
- pipeline.RemoveStep (typeof (RegenerateGuidStep));
- pipeline.AddStepBefore (typeof (OutputStep), new InjectSecurityAttributes ());
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
- public class PreserveCrypto : IStep {
-
- AnnotationStore annotations;
-
- public void Process (LinkContext context)
- {
- annotations = context.Annotations;
-
- ProcessCorlib (context);
- ProcessSystemCore (context);
- }
-
- void ProcessCorlib (LinkContext context)
- {
- AssemblyDefinition corlib;
- if (!context.TryGetLinkedAssembly ("mscorlib", out corlib))
- return;
-
- AddPreserveInfo (corlib, "DES", "DESCryptoServiceProvider");
- AddPreserveInfo (corlib, "DSA", "DSACryptoServiceProvider");
- AddPreserveInfo (corlib, "RandomNumberGenerator", "RNGCryptoServiceProvider");
- AddPreserveInfo (corlib, "SHA1", "SHA1CryptoServiceProvider");
- AddPreserveInfo (corlib, "SHA1", "SHA1Managed");
- AddPreserveInfo (corlib, "MD5", "MD5CryptoServiceProvider");
- AddPreserveInfo (corlib, "RC2", "RC2CryptoServiceProvider");
- AddPreserveInfo (corlib, "TripleDES", "TripleDESCryptoServiceProvider");
-
- AddPreserveInfo (corlib, "Rijndael", "RijndaelManaged");
- AddPreserveInfo (corlib, "RIPEMD160", "RIPEMD160Managed");
- AddPreserveInfo (corlib, "SHA256", "SHA256Managed");
- AddPreserveInfo (corlib, "SHA384", "SHA384Managed");
- AddPreserveInfo (corlib, "SHA512", "SHA512Managed");
-
- AddPreserveInfo (corlib, "HMAC", "HMACMD5");
- AddPreserveInfo (corlib, "HMAC", "HMACRIPEMD160");
- AddPreserveInfo (corlib, "HMAC", "HMACSHA1");
- AddPreserveInfo (corlib, "HMAC", "HMACSHA256");
- AddPreserveInfo (corlib, "HMAC", "HMACSHA384");
- AddPreserveInfo (corlib, "HMAC", "HMACSHA512");
-
- AddPreserveInfo (corlib, "HMACMD5", "MD5CryptoServiceProvider");
- AddPreserveInfo (corlib, "HMACRIPEMD160", "RIPEMD160Managed");
- AddPreserveInfo (corlib, "HMACSHA1", "SHA1CryptoServiceProvider");
- AddPreserveInfo (corlib, "HMACSHA1", "SHA1Managed");
- AddPreserveInfo (corlib, "HMACSHA256", "SHA256Managed");
- AddPreserveInfo (corlib, "HMACSHA384", "SHA384Managed");
- AddPreserveInfo (corlib, "HMACSHA512", "SHA512Managed");
-
- TryAddPreserveInfo (corlib, "Aes", "AesManaged");
-
- var corlibAes = GetCryptoType (corlib, "Aes");
- Preserve (corlibAes, GetCryptoType (corlib, "AesManaged"));
-
- AssemblyDefinition syscore;
- if (context.TryGetLinkedAssembly ("System.Core", out syscore))
- Preserve (corlibAes, GetCryptoType (syscore, "AesCryptoServiceProvider"));
- }
-
- void ProcessSystemCore (LinkContext context)
- {
- AssemblyDefinition syscore;
- if (!context.TryGetLinkedAssembly ("System.Core", out syscore))
- return;
-
- // AddPreserveInfo (syscore, "Aes", "AesCryptoServiceProvider");
- TryAddPreserveInfo (syscore, "Aes", "AesManaged");
- }
-
- bool TryAddPreserveInfo (AssemblyDefinition assembly, string name, string type)
- {
- var marker = GetCryptoType (assembly, name);
- if (marker == null)
- return false;
-
- var implementation = GetCryptoType (assembly, type);
- if (implementation == null)
- return false;
-
- Preserve (marker, implementation);
- return true;
- }
-
- void AddPreserveInfo (AssemblyDefinition assembly, string name, string type)
- {
- var marker = GetCryptoType (assembly, name);
- if (marker == null)
- throw new ArgumentException (name);
-
- var implementation = GetCryptoType (assembly, type);
- if (implementation == null)
- throw new ArgumentException (type);
-
- Preserve (marker, implementation);
- }
-
- void Preserve (TypeDefinition marker, TypeDefinition implementation)
- {
- if (marker == null || implementation == null)
- return;
- foreach (var constructor in implementation.GetConstructors ())
- annotations.AddPreservedMethod (marker, constructor);
- }
-
- TypeDefinition GetCryptoType (AssemblyDefinition assembly, string name)
- {
- return assembly.MainModule.GetType ("System.Security.Cryptography." + name);
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Xml.XPath;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class PreserveHttps : BaseStep {
-
- static string [] types = new [] {
- "System.Net.WebRequest",
- "System.Net.WebClient",
- "System.Net.Security.RemoteCertificateValidationCallback",
- "System.Web.Services.Protocols.WebClientProtocol",
- "System.Security.Cryptography.X509Certificates.X509Certificate",
- "System.ServiceModel.ClientBase`1",
- "System.Web.Services.WebServiceBindingAttribute",
- "System.Web.Services.Protocols.SoapHttpClientProtocol",
- "System.Xml.XmlDocument"
- };
-
- bool need_https;
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (need_https)
- return;
-
- if (Profile.IsSdkAssembly (assembly) || Profile.IsProductAssembly (assembly))
- return;
-
- if (HasNeededReference (assembly.MainModule))
- need_https = true;
- }
-
- static bool HasNeededReference (ModuleDefinition module)
- {
- foreach (var type in types)
- if (module.HasTypeReference (type))
- return true;
-
- return false;
- }
-
- protected override void EndProcess ()
- {
- if (!need_https)
- return;
-
- var mono_security = Context.Resolve ("Mono.Security");
- if (mono_security == null)
- return;
-
- if (Annotations.GetAction (mono_security) != AssemblyAction.Link)
- return;
-
- var xml_preserve = CreatePreserveStep ();
- Context.Pipeline.AddStepAfter (typeof (PreserveHttps), xml_preserve);
-// Context.Pipeline.AddStepAfter (xml_preserve, new PreserveCrypto ());
- }
-
- static IStep CreatePreserveStep ()
- {
- return new ResolveFromXmlStep (
- new XPathDocument (
- new StringReader (descriptor)));
- }
-
- const string descriptor = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
-<linker>
- <assembly fullname=""Mono.Security"">
- <type fullname=""Mono.Security.Protocol.Tls.HttpsClientStream"" />
- <type fullname=""Mono.Security.Protocol.Tls.SslClientStream"" />
- <type fullname=""Mono.Security.Protocol.Tls.SslStreamBase"" />
- </assembly>
-</linker>
-";
- }
-}
+++ /dev/null
-using System;
-
-using Mono.Linker;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class PreserveSoapHttpClients : BaseSubStep {
-
- public override SubStepTargets Targets {
- get { return SubStepTargets.Type; }
- }
-
- public override bool IsActiveFor (AssemblyDefinition assembly)
- {
- return Annotations.GetAction (assembly) == AssemblyAction.Link && !Profile.IsSdkAssembly (assembly);
- }
-
- public override void ProcessType (TypeDefinition type)
- {
- if (IsWebServiceClient (type))
- PreserveClient (type);
- }
-
- void PreserveClient (TypeDefinition type)
- {
- if (!type.HasMethods)
- return;
-
- foreach (MethodDefinition method in type.Methods) {
- string sync_method;
- if (!TryExtractSyncMethod (method, out sync_method))
- continue;
-
- AddPreservedMethod (method, sync_method);
- }
- }
-
- void AddPreservedMethod (MethodDefinition target, string methodName)
- {
- foreach (MethodDefinition method in target.DeclaringType.Methods)
- if (method.Name == methodName)
- Annotations.AddPreservedMethod (target, method);
- }
-
- static bool TryExtractSyncMethod (MethodDefinition method, out string sync_method)
- {
- if (TryExtractPrefixedMethodName ("Begin", method.Name, out sync_method))
- return true;
-
- if (TryExtractPrefixedMethodName ("End", method.Name, out sync_method))
- return true;
-
- if (TryExtractSuffixedMethodName ("Async", method.Name, out sync_method))
- return true;
-
- return false;
- }
-
- static bool TryExtractPrefixedMethodName (string prefix, string fullName, out string methodName)
- {
- methodName = null;
-
- int pos = fullName.IndexOf (prefix, StringComparison.Ordinal);
- if (pos == -1)
- return false;
-
- methodName = fullName.Substring (prefix.Length);
- return true;
- }
-
- static bool TryExtractSuffixedMethodName (string suffix, string fullName, out string methodName)
- {
- methodName = null;
-
- int pos = fullName.LastIndexOf (suffix, StringComparison.Ordinal);
- if (pos == -1)
- return false;
-
- methodName = fullName.Substring (0, pos);
- return true;
- }
-
- static bool IsWebServiceClient (TypeDefinition type)
- {
- return type.Inherits ("System.Web.Services.Protocols", "SoapHttpClientProtocol");
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// PrintStatus.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class PrintStatus : BaseStep {
-
- static string display_internalized = "display_internalized";
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- Console.WriteLine ("Assembly `{0}' ({1}) tuned", assembly.Name, assembly.MainModule.FullyQualifiedName);
-
- if (!DisplayInternalized ())
- return;
-
- foreach (TypeDefinition type in assembly.MainModule.Types)
- ProcessType (type);
- }
-
- bool DisplayInternalized ()
- {
- try {
- return bool.Parse (Context.GetParameter (display_internalized));
- } catch {
- return false;
- }
- }
-
- void ProcessType (TypeDefinition type)
- {
- ProcessCollection (type.Fields);
- ProcessCollection (type.Methods);
- }
-
- void ProcessCollection (ICollection collection)
- {
- foreach (IMetadataTokenProvider provider in collection)
- ProcessProvider (provider);
- }
-
- void ProcessProvider (IMetadataTokenProvider provider)
- {
- if (!TunerAnnotations.IsInternalized (Context, provider))
- return;
-
- Console.WriteLine ("[internalized] {0}", provider);
- }
- }
-}
+++ /dev/null
-//
-// PrintTypeMap.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class PrintTypeMap : BaseStep {
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- foreach (TypeDefinition type in assembly.MainModule.GetAllTypes ())
- PrintMap (type);
- }
-
- void PrintMap (TypeDefinition type)
- {
- if (!type.HasMethods)
- return;
-
- Console.WriteLine ("Type {0} map", type);
-
- foreach (MethodDefinition method in type.Methods) {
- if (!method.IsVirtual)
- continue;
-
- Console.WriteLine (" Method {0} map", method);
-
- IEnumerable<MethodDefinition> overrides = Annotations.GetOverrides (method);
- foreach (var @override in overrides ?? new MethodDefinition [0])
- Console.WriteLine (" HasOverride {0}", @override);
-
- IEnumerable<MethodDefinition> bases = Annotations.GetBaseMethods (method);
- foreach (var @base in bases ?? new MethodDefinition [0])
- Console.WriteLine (" Base {0}", @base);
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public abstract class Profile {
-
- static Profile current;
-
- public static Profile Current {
- get {
- if (current != null)
- return current;
-
- current = CreateProfile ("MonoTouch");
- if (current != null)
- return current;
-
- current = CreateProfile ("MonoDroid");
- if (current != null)
- return current;
-
- current = CreateProfile ("MonoMac");
- if (current != null)
- return current;
-
- throw new NotSupportedException ("No active profile");
- }
- set {
- current = value;
- }
- }
-
- static Profile CreateProfile (string name)
- {
- var type = Type.GetType (string.Format ("{0}.Tuner.{0}Profile", name));
- if (type == null)
- return null;
-
- return (Profile) Activator.CreateInstance (type);
- }
-
- public static bool IsSdkAssembly (AssemblyDefinition assembly)
- {
- return Current.IsSdk (assembly);
- }
-
- public static bool IsSdkAssembly (string assemblyName)
- {
- return Current.IsSdk (assemblyName);
- }
-
- public static bool IsProductAssembly (AssemblyDefinition assembly)
- {
- return Current.IsProduct (assembly);
- }
-
- public static bool IsProductAssembly (string assemblyName)
- {
- return Current.IsProduct (assemblyName);
- }
-
- protected virtual bool IsSdk (AssemblyDefinition assembly)
- {
- return IsSdk (assembly.Name.Name);
- }
-
- protected virtual bool IsProduct (AssemblyDefinition assembly)
- {
- return IsProduct (assembly.Name.Name);
- }
-
- protected abstract bool IsSdk (string assemblyName);
- protected abstract bool IsProduct (string assemblyName);
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public abstract class RemoveAttributesBase : BaseSubStep {
-
- public override SubStepTargets Targets {
- get {
- return SubStepTargets.Assembly
- | SubStepTargets.Type
- | SubStepTargets.Field
- | SubStepTargets.Method
- | SubStepTargets.Property
- | SubStepTargets.Event;
- }
- }
-
- public override bool IsActiveFor (AssemblyDefinition assembly)
- {
- return Annotations.GetAction (assembly) == AssemblyAction.Link;
- }
-
- public override void ProcessAssembly (AssemblyDefinition assembly)
- {
- ProcessAttributeProvider (assembly);
- ProcessAttributeProvider (assembly.MainModule);
- }
-
- public override void ProcessType (TypeDefinition type)
- {
- ProcessAttributeProvider (type);
-
- if (type.HasGenericParameters)
- ProcessAttributeProviderCollection (type.GenericParameters);
- }
-
- void ProcessAttributeProviderCollection (IList list)
- {
- for (int i = 0; i < list.Count; i++)
- ProcessAttributeProvider ((ICustomAttributeProvider) list [i]);
- }
-
- public override void ProcessField (FieldDefinition field)
- {
- ProcessAttributeProvider (field);
- }
-
- public override void ProcessMethod (MethodDefinition method)
- {
- ProcessMethodAttributeProvider (method);
- }
-
- void ProcessMethodAttributeProvider (MethodDefinition method)
- {
- ProcessAttributeProvider (method);
- ProcessAttributeProvider (method.MethodReturnType);
-
- if (method.HasParameters)
- ProcessAttributeProviderCollection (method.Parameters);
-
- if (method.HasGenericParameters)
- ProcessAttributeProviderCollection (method.GenericParameters);
- }
-
- public override void ProcessProperty (PropertyDefinition property)
- {
- ProcessAttributeProvider (property);
- }
-
- public override void ProcessEvent (EventDefinition @event)
- {
- ProcessAttributeProvider (@event);
- }
-
- void ProcessAttributeProvider (ICustomAttributeProvider provider)
- {
- if (!provider.HasCustomAttributes)
- return;
-
- for (int i = 0; i < provider.CustomAttributes.Count; i++) {
- var attrib = provider.CustomAttributes [i];
- if (!IsRemovedAttribute (attrib))
- continue;
-
- WillRemoveAttribute (provider, attrib);
- provider.CustomAttributes.RemoveAt (i--);
- }
- }
-
- protected abstract bool IsRemovedAttribute (CustomAttribute attribute);
- protected virtual void WillRemoveAttribute (ICustomAttributeProvider provider, CustomAttribute attribute) { }
- }
-}
+++ /dev/null
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class RemoveResources : IStep {
-
- readonly I18nAssemblies assemblies;
-
- public RemoveResources (I18nAssemblies assemblies)
- {
- this.assemblies = assemblies;
- }
-
- public virtual void Process (LinkContext context)
- {
- AssemblyDefinition assembly;
- if (!context.TryGetLinkedAssembly ("mscorlib", out assembly))
- return;
-
- // skip this if we're not linking mscorlib, e.g. --linkskip=mscorlib
- if (context.Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- var resources = assembly.MainModule.Resources;
-
- for (int i = 0; i < resources.Count; i++) {
- var resource = resources [i] as EmbeddedResource;
- if (resource == null)
- continue;
-
- switch (resource.Name) {
- case "collation.core.bin":
- case "collation.tailoring.bin":
- continue;
- default:
- if (!resource.Name.Contains ("cjk"))
- continue;
- if (IncludeCJK ())
- continue;
-
- resources.RemoveAt (i--);
- break;
- }
- }
- }
-
- bool IncludeCJK ()
- {
- return (assemblies & I18nAssemblies.CJK) != 0;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class RemoveSecurity : BaseSubStep {
-
- public override SubStepTargets Targets {
- get {
- return SubStepTargets.Assembly
- | SubStepTargets.Type
- | SubStepTargets.Method;
- }
- }
-
- public override bool IsActiveFor (AssemblyDefinition assembly)
- {
- return Annotations.GetAction (assembly) == AssemblyAction.Link;
- }
-
- public override void ProcessAssembly (AssemblyDefinition assembly)
- {
- ProcessSecurityProvider (assembly);
- }
-
- public override void ProcessType (TypeDefinition type)
- {
- ProcessSecurityProvider (type);
- }
-
- public override void ProcessMethod (MethodDefinition method)
- {
- ProcessSecurityProvider (method);
- }
-
- static void ProcessSecurityProvider (ISecurityDeclarationProvider provider)
- {
- if (!provider.HasSecurityDeclarations)
- return;
-
- provider.SecurityDeclarations.Clear ();
- }
- }
-}
+++ /dev/null
-//
-// RemoveSerialization.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
- public class RemoveSerialization : BaseStep {
-
- static readonly string _Serialization = "System.Runtime.Serialization";
- static readonly string _ISerializable = Concat (_Serialization, "ISerializable");
- static readonly string _IDeserializationCallback = Concat (_Serialization, "IDeserializationCallback");
- static readonly string _SerializationInfo = Concat (_Serialization, "SerializationInfo");
- static readonly string _StreamingContext = Concat (_Serialization, "StreamingContext");
-
- static readonly string _GetObjectData = "GetObjectData";
- static readonly string _OnDeserialization = "OnDeserialization";
-
- static string Concat (string lhs, string rhs)
- {
- return string.Concat (lhs, ".", rhs);
- }
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (assembly.Name.Name == "mscorlib")
- return;
-
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- foreach (ModuleDefinition module in assembly.Modules)
- foreach (TypeDefinition type in module.Types)
- ProcessType (type);
- }
-
- static void RemoveInterface (TypeDefinition type, string name)
- {
- for (int i = 0; i < type.Interfaces.Count; i++) {
- TypeReference iface = type.Interfaces [i].InterfaceType;
- if (iface.FullName == name) {
- type.Interfaces.RemoveAt (i);
- return;
- }
- }
- }
-
- static void RemoveSerializableFlag (TypeDefinition type)
- {
- type.Attributes &= ~TypeAttributes.Serializable;
- }
-
- static void ProcessType (TypeDefinition type)
- {
- RemoveSerializableFlag (type);
-
- RemoveInterface (type, _ISerializable);
- RemoveMethod (type, ".ctor", _SerializationInfo, _StreamingContext);
- RemoveInterfaceMethod (type, _ISerializable, _GetObjectData, _SerializationInfo, _StreamingContext);
-
- RemoveInterface (type, _IDeserializationCallback);
- RemoveInterfaceMethod (type, _IDeserializationCallback, _OnDeserialization, "System.Object");
-
- RemoveField (type);
- }
-
- static void RemoveField (TypeDefinition type)
- {
- for (int i = 0; i < type.Fields.Count; i++) {
- FieldDefinition field = type.Fields [i];
- if (field.FieldType.FullName == _SerializationInfo) {
- type.Fields.RemoveAt (i);
- break;
- }
- }
- }
-
- static bool ParametersMatch (IMethodSignature meth, string [] parameters)
- {
- for (int i = 0; i < parameters.Length; i++) {
- ParameterDefinition param = meth.Parameters [i];
- if (param.ParameterType.FullName != parameters [i])
- return false;
- }
-
- return true;
- }
-
- static void RemoveInterfaceMethod (TypeDefinition type, string iface, string method, params string [] parameters)
- {
- RemoveMethod (type, method, parameters);
- RemoveMethod (type, Concat (iface, method), parameters);
- }
-
- static void RemoveMethod (TypeDefinition type, string name, params string [] parameters)
- {
- RemoveMethod (type.Methods, name, parameters);
- }
-
- static void RemoveMethod (IList container, string name, params string [] parameters)
- {
- for (int i = 0; i < container.Count; i++) {
- MethodDefinition method = (MethodDefinition) container [i];
- if (method.Name != name)
- continue;
-
- if (method.Parameters.Count != parameters.Length)
- continue;
-
- if (!ParametersMatch (method, parameters))
- continue;
-
- container.RemoveAt (i);
- return;
- }
- }
- }
-}
+++ /dev/null
-//
-// TunerAnnotations.cs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Cecil;
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
- public class TunerAnnotations {
-
- static readonly object _internalizedKey = new object ();
-
- public static void Internalized (LinkContext context, IMetadataTokenProvider provider)
- {
- var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey);
- annotations [provider] = _internalizedKey;
- }
-
- public static bool IsInternalized (LinkContext context, IMetadataTokenProvider provider)
- {
- var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey);
-
- return annotations.ContainsKey (provider);
- }
-
- private TunerAnnotations ()
- {
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
- public class ApplyPreserveAttribute : ApplyPreserveAttributeBase {
-
- protected override string PreserveAttribute {
- get { return "MonoMac.Foundation.PreserveAttribute"; }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-using Mono.Tuner;
-
-namespace MonoMac.Tuner {
-
- static class Extensions {
-
- const string NSObject = "MonoMac.Foundation.NSObject";
- const string INativeObject = "MonoMac.ObjCRuntime.INativeObject";
-
- public static bool IsNSObject (this TypeDefinition type)
- {
- return type.Inherits (NSObject);
- }
-
- public static bool IsNativeObject (this TypeDefinition type)
- {
- return type.Implements (INativeObject);
- }
- }
-}
+++ /dev/null
-//
-// MarkNSObjects.cs
-//
-// Authors:
-// Jb Evain (jbevain@novell.com)
-// Sebastien Pouliot <sebastien@xamarin.com>
-//
-// (C) 2009 Novell, Inc.
-// Copyright (C) 2011 Xamarin, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
- public class MarkNSObjects : MarkNSObjectsBase {
-
- protected override string ExportAttribute {
- get { return "MonoMac.Foundation.ExportAttribute"; }
- }
-
- public override void ProcessType (TypeDefinition type)
- {
- if (!type.IsNSObject () || !type.IsNativeObject ())
- return;
-
- base.ProcessType (type);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace MonoMac.Tuner {
-
- public class MethodMapInjection : BaseStep {
-
- struct ExportedMethod {
- public readonly CustomAttribute attribute;
- public readonly MethodDefinition method;
-
- public ExportedMethod (CustomAttribute attribute, MethodDefinition method)
- {
- this.attribute = attribute;
- this.method = method;
- }
- }
-
- ModuleDefinition module;
-
- bool imported;
- TypeReference void_type;
- TypeReference dictionary_intptr_methoddesc;
- MethodReference dictionary_intptr_methoddesc_ctor;
- MethodReference dictionary_intptr_methoddesc_set_item;
- MethodReference methoddesc_ctor;
- MethodReference selector_get_handle;
- MethodReference methodbase_get_method_from_handle;
- MethodReference class_register_methods;
- MethodReference type_get_type_from_handle;
- FieldReference selector_init;
-
- protected override void ProcessAssembly (AssemblyDefinition assembly)
- {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
- return;
-
- module = assembly.MainModule;
-
- foreach (TypeDefinition type in module.GetAllTypes ()) {
- if (!type.IsNSObject ())
- continue;
-
- ProcessNSObject (type);
- }
-
- imported = false;
- }
-
- void PrepareImports ()
- {
- if (imported)
- return;
-
- var corlib = Context.GetAssembly ("mscorlib");
-
- void_type = Import (corlib, "System.Void");
-
- var monomac = Context.GetAssembly ("MonoMac");
-
- var dictionary = Import (corlib, "System.Collections.Generic.Dictionary`2");
-
- var intptr = Import (corlib, "System.IntPtr");
- var method_desc = Import (monomac, "MonoMac.ObjCRuntime.MethodDescription");
-
- var dic_i_md = new GenericInstanceType (dictionary);
- dic_i_md.GenericArguments.Add (intptr);
- dic_i_md.GenericArguments.Add (method_desc);
- dictionary_intptr_methoddesc = dic_i_md;
-
- dictionary_intptr_methoddesc_ctor = Import (".ctor", dic_i_md, false, void_type, Import (corlib, "System.Int32"));
-
- dictionary_intptr_methoddesc_set_item = Import ("set_Item", dic_i_md, false, void_type,
- dictionary.GenericParameters [0],
- dictionary.GenericParameters [1]);
-
- methoddesc_ctor = Import (".ctor", method_desc, false, void_type,
- Import (corlib, "System.Reflection.MethodBase"),
- Import (monomac, "MonoMac.ObjCRuntime.ArgumentSemantic"));
-
- var selector = Import (monomac, "MonoMac.ObjCRuntime.Selector");
-
- selector_get_handle = Import ("GetHandle", selector, true, intptr, Import (corlib, "System.String"));
- selector_init = new FieldReference ("Init", selector, intptr);
-
- var methodbase = Import (corlib, "System.Reflection.MethodBase");
-
- methodbase_get_method_from_handle = Import ("GetMethodFromHandle", methodbase, true, methodbase, Import (corlib, "System.RuntimeMethodHandle"));
-
- var type = Import (corlib, "System.Type");
-
- type_get_type_from_handle = Import ("GetTypeFromHandle", type, true, type, Import (corlib, "System.RuntimeTypeHandle"));
-
- var @class = Import (monomac, "MonoMac.ObjCRuntime.Class");
-
- class_register_methods = Import ("RegisterMethods", @class, true, void_type, type, dic_i_md);
-
- imported = true;
- }
-
- MethodReference Import (string name, TypeReference declaring_type, bool @static, TypeReference return_type, params TypeReference [] parameters_type)
- {
- var reference = new MethodReference (name, return_type, declaring_type) {
- HasThis = !@static,
- ExplicitThis = false,
- CallingConvention = MethodCallingConvention.Default,
- };
-
- foreach (var parameter_type in parameters_type)
- reference.Parameters.Add (new ParameterDefinition (parameter_type));
-
- return reference;
- }
-
- TypeReference Import (TypeReference type)
- {
- return module.Import (type);
- }
-
- TypeReference Import (AssemblyDefinition assembly, string type_name)
- {
- return Import (assembly.MainModule.GetType (type_name));
- }
-
- void ProcessNSObject (TypeDefinition type)
- {
- var exported = new List<ExportedMethod> ();
-
- if (type.HasMethods) {
- ProcessMethods (type, exported);
- ProcessConstructors (type, exported);
- }
-
- if (exported.Count == 0)
- return;
-
- InjectMethodMap (type, exported);
- }
-
- void InjectMethodMap (TypeDefinition type, List<ExportedMethod> exported_methods)
- {
- PrepareImports ();
-
- var cctor = GetTypeConstructor (type);
-
- var selectors = MapSelectors (cctor);
-
- var map = new VariableDefinition (dictionary_intptr_methoddesc);
- map.Name = "$method_map";
- cctor.Body.Variables.Add (map);
- cctor.Body.SimplifyMacros ();
-
- var il = cctor.Body.GetILProcessor ();
-
- var instructions = new List<Instruction> {
- il.Create (OpCodes.Ldc_I4, exported_methods.Count),
- il.Create (OpCodes.Newobj, dictionary_intptr_methoddesc_ctor),
- il.Create (OpCodes.Stloc, map),
- };
-
- foreach (var exported in exported_methods) {
-
- instructions.Add (il.Create (OpCodes.Ldloc, map));
-
- if (!IsDefaultConstructor (exported)) {
- var selector_name = GetSelectorName (exported);
- FieldReference selector;
-
- if (selectors != null && selectors.TryGetValue (selector_name, out selector)) {
- instructions.Add (il.Create (OpCodes.Ldsfld, selector));
- } else {
- instructions.AddRange (new [] {
- il.Create (OpCodes.Ldstr, selector_name),
- il.Create (OpCodes.Call, selector_get_handle),
- });
- }
- } else
- instructions.Add (il.Create (OpCodes.Ldsfld, selector_init));
-
- instructions.AddRange (new [] {
- il.Create (OpCodes.Ldtoken, exported.method),
- il.Create (OpCodes.Call, methodbase_get_method_from_handle),
- il.Create (OpCodes.Ldc_I4, GetArgumentSemantic (exported)),
- il.Create (OpCodes.Newobj, methoddesc_ctor),
- il.Create (OpCodes.Callvirt, dictionary_intptr_methoddesc_set_item),
- });
- }
-
- instructions.AddRange (new [] {
- il.Create (OpCodes.Ldtoken, type),
- il.Create (OpCodes.Call, type_get_type_from_handle),
- il.Create (OpCodes.Ldloc, map),
- il.Create (OpCodes.Call, class_register_methods),
- });
-
- Append (il, instructions);
-
- cctor.Body.OptimizeMacros ();
- }
-
- static Dictionary<string, FieldReference> MapSelectors (MethodDefinition cctor)
- {
- var instructions = cctor.Body.Instructions;
- Dictionary<string, FieldReference> selectors = null;
-
- for (int i = 0; i < instructions.Count; i++) {
- var instruction = instructions [i];
-
- FieldReference field;
- if (!IsCreateSelector (instruction, out field))
- continue;
-
- if (selectors == null)
- selectors = new Dictionary<string, FieldReference> ();
-
- selectors.Add ((string) instruction.Operand, field);
- }
-
- return selectors;
- }
-
- static bool IsCreateSelector (Instruction instruction, out FieldReference field)
- {
- field = null;
-
- if (instruction.OpCode != OpCodes.Ldstr)
- return false;
-
- if (instruction.Next == null)
- return false;
-
- instruction = instruction.Next;
-
- if (instruction.OpCode != OpCodes.Call)
- return false;
-
- var method = (MethodReference) instruction.Operand;
- if (method.DeclaringType.Name != "Selector")
- return false;
-
- if (method.Name != "GetHandle" && method.Name != "sel_registerName")
- return false;
-
- if (instruction.Next == null)
- return false;
-
- instruction = instruction.Next;
-
- if (instruction.OpCode != OpCodes.Stsfld)
- return false;
-
- field = instruction.Operand as FieldReference;
- return true;
- }
-
- static bool IsDefaultConstructor (ExportedMethod exported)
- {
- return exported.attribute == null && exported.method.IsConstructor && !exported.method.IsStatic;
- }
-
- static void Append (ILProcessor il, IEnumerable<Instruction> instructions)
- {
- var method_instructions = il.Body.Instructions;
- var last = method_instructions [method_instructions.Count - 1];
-
- foreach (var instruction in instructions)
- il.InsertBefore (last, instruction);
- }
-
- static int GetArgumentSemantic (ExportedMethod exported)
- {
- if (exported.attribute == null)
- return 0; // Assign
-
- var arguments = exported.attribute.ConstructorArguments;
-
- if (arguments.Count == 2)
- return (int) arguments [1].Value;
-
- if (arguments.Count == 1)
- return -1; // None
-
- return 0; // Assign
- }
-
- static string GetSelectorName (ExportedMethod exported)
- {
- var arguments = exported.attribute.ConstructorArguments;
-
- if (arguments.Count == 0)
- return exported.method.Name;
-
- return (string) arguments [0].Value;
- }
-
- MethodDefinition GetTypeConstructor (TypeDefinition type)
- {
- return type.GetTypeConstructor () ?? CreateTypeConstructor (type);
- }
-
- MethodDefinition CreateTypeConstructor (TypeDefinition type)
- {
- var cctor = new MethodDefinition (".cctor", MethodAttributes.Private | MethodAttributes.Static | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, void_type);
- cctor.Body.GetILProcessor ().Emit (OpCodes.Ret);
-
- type.Methods.Add (cctor);
-
- return cctor;
- }
-
- void ProcessConstructors (TypeDefinition type, List<ExportedMethod> exported)
- {
- foreach (MethodDefinition ctor in type.GetConstructors ()) {
- if (!ctor.HasParameters && !ctor.IsStatic) {
- exported.Add (new ExportedMethod (null, ctor));
- continue;
- }
-
- CustomAttribute export;
- if (!TryGetExportAttribute (ctor, out export))
- continue;
-
- exported.Add (new ExportedMethod (export, ctor));
- }
- }
-
- static bool TryGetExportAttribute (MethodDefinition method, out CustomAttribute export)
- {
- export = null;
-
- if (!method.HasCustomAttributes)
- return false;
-
- foreach (CustomAttribute attribute in method.CustomAttributes) {
- if (attribute.AttributeType.FullName != "MonoMac.Foundation.ExportAttribute")
- continue;
-
- export = attribute;
- return true;
- }
-
- return false;
- }
-
- void ProcessMethods (TypeDefinition type, List<ExportedMethod> exported)
- {
- foreach (MethodDefinition method in type.GetMethods ()) {
- CustomAttribute attribute;
- if (TryGetExportAttribute (method, out attribute)) {
- exported.Add (new ExportedMethod (attribute, method));
- continue;
- }
-
- if (!method.IsVirtual)
- continue;
-
- var bases = Annotations.GetBaseMethods (method);
- if (bases == null)
- continue;
-
- foreach (MethodDefinition @base in bases) {
- if (@base.DeclaringType.IsInterface)
- continue;
-
- if (TryGetExportAttribute (@base, out attribute)) {
- exported.Add (new ExportedMethod (attribute, method));
- break;
- }
- }
- }
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8" ?>
-<linker>
- <assembly fullname="MonoMac">
- <namespace fullname="MonoMac.ObjCRuntime" />
- <!--
- <type fullname="MonoMac.ObjCRuntime.Runtime" />
- <type fullname="MonoMac.ObjCRuntime.Class" />
- <type fullname="MonoMac.ObjCRuntime.Selector" />
- <type fullname="MonoMac.ObjCRuntime.NativeConstructorBuilder" />
- <type fullname="MonoMac.ObjCRuntime.NativeImplementationBuilder" />
- <type fullname="MonoMac.ObjCRuntime.NativeMethodBuilder" />
- <type fullname="MonoMac.ObjCRuntime.INativeObject" />
- -->
- <type fullname="MonoMac.Foundation.NSObject" preserve="fields">
- <method name="NativeRelease" />
- <method name="NativeRetain" />
- <method name="Retain" />
- </type>
- <type fullname="MonoMac.Foundation.NSArray" preserve="fields">
- <method name="ArrayFromHandle" />
- <method name="StringArrayFromHandle" />
- <method name="FromNSObjects" />
- <method name="FromStrings" />
- </type>
- <type fullname="MonoMac.Foundation.ExportAttribute" />
- </assembly>
- <assembly fullname="mscorlib">
- <type fullname="System.Runtime.Serialization.FormatterServices">
- <method name="GetUninitializedObject" />
- </type>
- <type fullname="System.Runtime.InteropServices.Marshal">
- <method name="StructureToPtr" />
- </type>
- <type fullname="System.Runtime.InteropServices.MarshalAsAttribute">
- <field name="MarshalTypeRef" />
- </type>
- </assembly>
-</linker>
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
- class MonoMacProfile : Profile {
-
- static readonly HashSet<string> Sdk = new HashSet<string> {
- "mscorlib",
- "I18N.CJK",
- "I18N",
- "I18N.MidEast",
- "I18N.Other",
- "I18N.Rare",
- "I18N.West",
- "Microsoft.Build.Engine",
- "Microsoft.Build.Framework",
- "Microsoft.Build.Tasks.v4.0",
- "Microsoft.Build.Utilities.v4.0",
- "Microsoft.CSharp",
- "Microsoft.Web.Infrastructure",
- "Mono.C5",
- "Mono.Cairo",
- "Mono.CodeContracts",
- "Mono.CompilerServices.SymbolWriter",
- "Mono.Configuration.Crypto",
- "Mono.CSharp",
- "Mono.Data.Sqlite",
- "Mono.Data.Tds",
- "Mono.Debugger.Soft",
- "Mono.Http",
- "Mono.Management",
- "Mono.Messaging",
- "Mono.Messaging.RabbitMQ",
- "Mono.Options",
- "Mono.Parallel",
- "Mono.Posix",
- "Mono.Security",
- "Mono.Security.Win32",
- "Mono.Simd",
- "Mono.Tasklets",
- "Mono.Tuner",
- "Mono.WebBrowser",
- "Mono.Web",
- "Novell.Directory.Ldap",
- "Npgsql",
- "OpenSystem.C",
- "PEAPI",
- "System.ComponentModel.Composition",
- "System.ComponentModel.DataAnnotations",
- "System.Configuration",
- "System.Configuration.Install",
- "System.Core",
- "System.Data.DataSetExtensions",
- "System.Data",
- "System.Data.Linq",
- "System.Data.OracleClient",
- "System.Data.Services.Client",
- "System.Data.Services",
- "System.Design",
- "System.DirectoryServices",
- "System",
- "System.Drawing.Design",
- "System.Drawing",
- "System.Dynamic",
- "System.EnterpriseServices",
- "System.IdentityModel",
- "System.IdentityModel.Selectors",
- "System.Management",
- "System.Messaging",
- "System.Net",
- "System.Numerics",
- "System.Runtime.Caching",
- "System.Runtime.DurableInstancing",
- "System.Runtime.Remoting",
- "System.Runtime.Serialization",
- "System.Runtime.Serialization.Formatters.Soap",
- "System.Security",
- "System.ServiceModel.Discovery",
- "System.ServiceModel",
- "System.ServiceModel.Routing",
- "System.ServiceModel.Web",
- "System.ServiceProcess",
- "System.Transactions",
- "System.Web.Abstractions",
- "System.Web.ApplicationServices",
- "System.Web",
- "System.Web.DynamicData",
- "System.Web.Extensions.Design",
- "System.Web.Extensions",
- "System.Web.Routing",
- "System.Web.Services",
- "System.Windows.Forms.DataVisualization",
- "System.Windows.Forms",
- "System.Xaml",
- "System.Xml",
- "System.Xml.Linq",
- "WebMatrix.Data",
- "WindowsBase",
- "Microsoft.VisualBasic",
- };
-
- protected override bool IsSdk (AssemblyDefinition assembly)
- {
- return Sdk.Contains (assembly.Name.Name);
- }
-
- protected override bool IsProduct (AssemblyDefinition assembly)
- {
- return assembly.Name.Name == "MonoMac";
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-using Mono.Tuner;
-
-namespace MonoMac.Tuner {
-
- public class RemoveSelectors : IStep {
-
- public void Process (LinkContext context)
- {
- AssemblyDefinition monomac;
- if (!context.TryGetLinkedAssembly ("MonoMac", out monomac))
- return;
-
- foreach (TypeDefinition type in monomac.MainModule.Types) {
- if (!type.IsNSObject ())
- continue;
-
- ProcessNSObject (type);
- }
- }
-
- static void ProcessNSObject (TypeDefinition type)
- {
- var selectors = PopulateSelectors (type);
- if (selectors == null)
- return;
-
- foreach (var method in CollectMethods (type))
- CheckSelectorUsage (method, selectors);
-
- if (selectors.Count == 0)
- return;
-
- PatchStaticConstructor (type, selectors);
- RemoveUnusedSelectors (type, selectors);
- }
-
- static void CheckSelectorUsage (MethodDefinition method, HashSet<FieldDefinition> selectors)
- {
- if (!method.HasBody)
- return;
-
- foreach (Instruction instruction in method.Body.Instructions) {
- switch (instruction.OpCode.OperandType) {
- case OperandType.InlineTok:
- case OperandType.InlineField:
- var field = instruction.Operand as FieldDefinition;
- if (field == null)
- continue;
-
- if (selectors.Contains (field))
- selectors.Remove (field);
-
- break;
- }
- }
- }
-
- static void PatchStaticConstructor (TypeDefinition type, HashSet<FieldDefinition> selectors)
- {
- var cctor = type.GetTypeConstructor ();
- if (cctor == null || !cctor.HasBody)
- return;
-
- var instructions = cctor.Body.Instructions;
-
- for (int i = 0; i < instructions.Count; i++) {
- var instruction = instructions [i];
- if (!IsCreateSelector (instruction, selectors))
- continue;
-
- instructions.RemoveAt (i--);
- instructions.RemoveAt (i--);
- instructions.RemoveAt (i--);
- }
- }
-
- static bool IsCreateSelector (Instruction instruction, HashSet<FieldDefinition> selectors)
- {
- if (instruction.OpCode != OpCodes.Stsfld)
- return false;
-
- var field = instruction.Operand as FieldDefinition;
- if (field == null)
- return false;
-
- if (!selectors.Contains (field))
- return false;
-
- instruction = instruction.Previous;
- if (instruction == null)
- return false;
-
- if (instruction.OpCode != OpCodes.Call)
- return false;
-
- if (!IsRegisterSelector (instruction.Operand as MethodReference))
- return false;
-
- instruction = instruction.Previous;
- if (instruction == null)
- return false;
-
- if (instruction.OpCode != OpCodes.Ldstr)
- return false;
-
- return true;
- }
-
- static bool IsRegisterSelector (MethodReference method)
- {
- if (method == null)
- return false;
-
- if (method.Name != "GetHandle" && method.Name != "sel_registerName")
- return false;
-
- if (method.DeclaringType.FullName != "MonoMac.ObjCRuntime.Selector")
- return false;
-
- return true;
- }
-
- static void RemoveUnusedSelectors (TypeDefinition type, HashSet<FieldDefinition> selectors)
- {
- var fields = type.Fields;
-
- for (int i = 0; i < fields.Count; i++)
- if (selectors.Contains (fields [i]))
- fields.RemoveAt (i--);
- }
-
- static HashSet<FieldDefinition> PopulateSelectors (TypeDefinition type)
- {
- if (!type.HasFields)
- return null;
-
- HashSet<FieldDefinition> selectors = null;
-
- foreach (FieldDefinition field in type.Fields) {
- if (!IsSelector (field))
- continue;
-
- if (selectors == null)
- selectors = new HashSet<FieldDefinition> ();
-
- selectors.Add (field);
- }
-
- return selectors;
- }
-
- static bool IsSelector (FieldDefinition field)
- {
- if (!field.IsStatic)
- return false;
-
- if (field.FieldType.FullName != "System.IntPtr")
- return false;
-
- if (!field.Name.StartsWith ("sel"))
- return false;
-
- return true;
- }
-
- static IEnumerable<MethodDefinition> CollectMethods (TypeDefinition type)
- {
- if (!type.HasMethods)
- yield break;
-
- foreach (MethodDefinition method in type.Methods) {
- if (method.IsStatic && method.IsConstructor)
- continue;
-
- yield return method;
- }
- }
- }
-}
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
gunichar2 *utf16_basename;
time_t create_time;
glong bytes;
- int thr_ret;
gboolean ret = FALSE;
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FIND,
return(FALSE);
}
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
retry:
if (find_handle->count >= find_handle->num) {
g_free (utf16_basename);
cleanup:
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
return(ret);
}
{
struct _WapiHandle_find *find_handle;
gboolean ok;
- int thr_ret;
if (handle == NULL) {
SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
g_strfreev (find_handle->namelist);
g_free (find_handle->dir_part);
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
mono_w32handle_unref (handle);
cleanup_close (gpointer handle, gpointer data, gpointer user_data)
{
if (mono_w32handle_get_type (handle) == MONO_W32HANDLE_SOCKET)
- mono_w32handle_ops_close (handle, data);
+ mono_w32handle_force_close (handle, data);
return FALSE;
}
#include <mono/utils/gc_wrapper.h>
#include <mono/utils/mono-os-mutex.h>
#include <mono/utils/mono-counters.h>
+#include <mono/utils/mono-compiler.h>
#if HAVE_BOEHM_GC
}
#else
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_boehm_gc_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (boehm_gc);
#endif /* no Boehm GC */
int num_array_interfaces;
int is_enumerator = FALSE;
+ mono_loader_lock ();
+
mono_class_setup_supertypes (klass);
/*
* get the implicit generic interfaces for either the arrays or for System.Array/InternalEnumerator<T>
}
/* Publish the data */
- mono_loader_lock ();
-
klass->max_interface_id = max_iid;
/*
* We might get called multiple times:
klass->interface_bitmap = bitmap;
#endif
}
+end:
mono_loader_unlock ();
-end:
g_free (interfaces_full);
g_free (interface_offsets_full);
g_free (array_interfaces);
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
#include "mono/metadata/console-win32-internals.h"
MonoBoolean
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_console_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (console_win32_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
#include "mono/metadata/coree-internals.h"
BOOL STDMETHODCALLTYPE
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_coree_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (coree_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
gboolean
mono_file_io_unlock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error);
+HANDLE
+mono_file_io_get_console_output (void);
+
+HANDLE
+mono_file_io_get_console_error (void);
+
+HANDLE
+mono_file_io_get_console_input (void);
+
#endif /* __MONO_FILE_IO_INTERNALS_H__ */
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
#include "mono/metadata/file-io-windows-internals.h"
gboolean
return result;
}
+HANDLE
+mono_file_io_get_console_output (void)
+{
+ MonoError mono_error;
+ mono_error_init (&mono_error);
+
+ g_unsupported_api ("GetStdHandle (STD_OUTPUT_HANDLE)");
+
+ mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_OUTPUT_HANDLE)");
+ mono_error_set_pending_exception (&mono_error);
+
+ SetLastError (ERROR_NOT_SUPPORTED);
+
+ return INVALID_HANDLE_VALUE;
+}
+
+HANDLE
+mono_file_io_get_console_input (void)
+{
+ MonoError mono_error;
+ mono_error_init (&mono_error);
+
+ g_unsupported_api ("GetStdHandle (STD_INPUT_HANDLE)");
+
+ mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_INPUT_HANDLE)");
+ mono_error_set_pending_exception (&mono_error);
+
+ SetLastError (ERROR_NOT_SUPPORTED);
+
+ return INVALID_HANDLE_VALUE;
+}
+
+HANDLE
+mono_file_io_get_console_error (void)
+{
+ MonoError mono_error;
+ mono_error_init (&mono_error);
+
+ g_unsupported_api ("GetStdHandle (STD_ERROR_HANDLE)");
+
+ mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_ERROR_HANDLE)");
+ mono_error_set_pending_exception (&mono_error);
+
+ SetLastError (ERROR_NOT_SUPPORTED);
+
+ return INVALID_HANDLE_VALUE;
+}
+
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_file_io_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (file_io_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
return(ret);
}
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+HANDLE
+mono_file_io_get_console_output (void)
+{
+ return GetStdHandle (STD_OUTPUT_HANDLE);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
HANDLE
ves_icall_System_IO_MonoIO_get_ConsoleOutput ()
{
- return GetStdHandle (STD_OUTPUT_HANDLE);
+ return mono_file_io_get_console_output ();
}
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+HANDLE
+mono_file_io_get_console_input (void)
+{
+ return GetStdHandle (STD_INPUT_HANDLE);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
HANDLE
ves_icall_System_IO_MonoIO_get_ConsoleInput ()
{
- return GetStdHandle (STD_INPUT_HANDLE);
+ return mono_file_io_get_console_input ();
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+HANDLE
+mono_file_io_get_console_error (void)
+{
+ return GetStdHandle (STD_ERROR_HANDLE);
}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
HANDLE
ves_icall_System_IO_MonoIO_get_ConsoleError ()
{
- return GetStdHandle (STD_ERROR_HANDLE);
+ return mono_file_io_get_console_error ();
}
MonoBoolean
*/
#include <config.h>
-
-#ifdef HOST_WIN32
+#include <glib.h>
+#include <mono/utils/mono-compiler.h>
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) && defined(HOST_WIN32)
#include <glib.h>
return result;
}
+#else
+
+MONO_EMPTY_SOURCE_FILE (file_mmap_windows);
+
#endif
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
#include "mono/metadata/icall-windows-internals.h"
MonoString *
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_icall_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (icall_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
#include <mono/metadata/metadata.h>
#include <mono/metadata/image.h>
#include <mono/utils/mono-error.h>
-#include <mono/utils/mono-dl.h>
MONO_BEGIN_DECLS
void*
mono_lookup_internal_call_full (MonoMethod *method, mono_bool *uses_handles);
-void
-mono_loader_register_module (const char *name, MonoDl *module);
-
MONO_API const char*
mono_lookup_icall_symbol (MonoMethod *m);
#endif
#include <mono/io-layer/io-layer.h>
+#include <mono/utils/mono-compiler.h>
#include "lock-tracer.h"
}
#else
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_lock_tracer_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (lock_tracer);
#endif /* LOCK_TRACER */
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
#include "mono/metadata/marshal-windows-internals.h"
void *
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_marshal_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (marshal_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
MonoImageSet *
mono_find_image_set_owner (void *ptr);
+void
+mono_loader_register_module (const char *name, MonoDl *module);
+
#endif /* __MONO_METADATA_INTERNALS_H__ */
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
+#include <mono/utils/mono-compiler.h>
#include "mono-endian.h"
#if NO_UNALIGNED_ACCESS
return r.i;
}
+#else /* NO_UNALIGNED_ACCESS */
+
+MONO_EMPTY_SOURCE_FILE (mono_endian);
+
#endif
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
#include "mono/metadata/mono-security-windows-internals.h"
gpointer
}
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_security_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
}
#else
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_null_gc_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (null_gc);
#endif /* HAVE_NULL_GC */
ok = mono_w32handle_lookup (handle, type, (gpointer *)&event_handle);
if (!ok) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
if (!event_handle->manual) {
g_assert (event_handle->set_count > 0);
static gpointer event_handle_create (MonoW32HandleEvent *event_handle, MonoW32HandleType type, gboolean manual, gboolean initial)
{
gpointer handle;
- int thr_ret;
event_handle->manual = manual;
event_handle->set_count = (initial && !manual) ? 1 : 0;
handle = mono_w32handle_new (type, event_handle);
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
- __func__, mono_w32handle_ops_typename (type));
+ __func__, mono_w32handle_get_typename (type));
SetLastError (ERROR_GEN_FAILURE);
return NULL;
}
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
if (initial)
mono_w32handle_set_signal_state (handle, TRUE, FALSE);
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return handle;
}
{
MonoW32HandleEvent event_handle;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_EVENT));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_EVENT));
return event_handle_create (&event_handle, MONO_W32HANDLE_EVENT, manual, initial);
}
gchar *utf8_name;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDEVENT));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDEVENT));
/* w32 seems to guarantee that opening named objects can't race each other */
mono_w32handle_namespace_lock ();
{
MonoW32HandleType type;
MonoW32HandleEvent *event_handle;
- int thr_ret;
if (handle == NULL) {
SetLastError (ERROR_INVALID_HANDLE);
if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
if (!event_handle->manual) {
event_handle->set_count = 1;
mono_w32handle_set_signal_state (handle, TRUE, TRUE);
}
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
return TRUE;
}
{
MonoW32HandleType type;
MonoW32HandleEvent *event_handle;
- int thr_ret;
SetLastError (ERROR_SUCCESS);
if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: resetting %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
if (!mono_w32handle_issignalled (handle)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: no need to reset %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: obtained write lock on %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
mono_w32handle_set_signal_state (handle, FALSE, FALSE);
}
event_handle->set_count = 0;
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
return TRUE;
}
if (type != search_data->type) {
/* Its the wrong type, so fail now */
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name but is wrong type: %s",
- __func__, handle, mono_w32handle_ops_typename (type));
+ __func__, handle, mono_w32handle_get_typename (type));
search_data->ret = INVALID_HANDLE_VALUE;
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name and type",
g_error ("%s: type %s does not have a namespace", __func__, type);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Lookup for handle named [%s] type %s",
- __func__, name, mono_w32handle_ops_typename (type));
+ __func__, name, mono_w32handle_get_typename (type));
search_data.ret = NULL;
search_data.type = type;
*/
#include <config.h>
-
-#if !defined(HOST_WIN32)
-
#include <glib.h>
-#include <pthread.h>
-#include <errno.h>
-#include <unistd.h>
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#include <string.h>
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-#ifdef HAVE_SYS_UN_H
-# include <sys/un.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-# include <sys/mman.h>
-#endif
-#ifdef HAVE_DIRENT_H
-# include <dirent.h>
-#endif
-#include <sys/stat.h>
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
#include "w32handle.h"
return handle_data->type;
}
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type);
+
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type)
+{
+ return mono_w32handle_ops_typename (type);
+}
+
void
mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast)
{
return handle_data->signalled;
}
-static int
+static void
mono_w32handle_lock_signal_mutex (void)
{
#ifdef DEBUG
#endif
mono_os_mutex_lock (&global_signal_mutex);
-
- return 0;
}
-static int
+static void
mono_w32handle_unlock_signal_mutex (void)
{
#ifdef DEBUG
#endif
mono_os_mutex_unlock (&global_signal_mutex);
-
- return 0;
}
-int
+void
mono_w32handle_lock_handle (gpointer handle)
{
MonoW32HandleBase *handle_data;
-#ifdef DEBUG
- g_message ("%s: locking handle %p", __func__, handle);
-#endif
-
- if (!mono_w32handle_lookup_data (handle, &handle_data)) {
- return(0);
- }
+ if (!mono_w32handle_lookup_data (handle, &handle_data))
+ g_error ("%s: failed to lookup handle %p", __func__, handle);
mono_w32handle_ref (handle);
mono_os_mutex_lock (&handle_data->signal_mutex);
- return 0;
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: lock handle %p", __func__, handle);
}
-int
+gboolean
mono_w32handle_trylock_handle (gpointer handle)
{
MonoW32HandleBase *handle_data;
- int ret;
+ gboolean locked;
-#ifdef DEBUG
- g_message ("%s: locking handle %p", __func__, handle);
-#endif
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: trylock handle %p", __func__, handle);
- if (!mono_w32handle_lookup_data (handle, &handle_data)) {
- return(0);
- }
+ if (!mono_w32handle_lookup_data (handle, &handle_data))
+ g_error ("%s: failed to lookup handle %p", __func__, handle);
mono_w32handle_ref (handle);
- ret = mono_os_mutex_trylock (&handle_data->signal_mutex);
- if (ret != 0) {
+ locked = mono_os_mutex_trylock (&handle_data->signal_mutex) == 0;
+ if (!locked)
mono_w32handle_unref (handle);
- }
- return(ret);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: trylock handle %p, locked: %s", __func__, handle, locked ? "true" : "false");
+
+ return locked;
}
-int
+void
mono_w32handle_unlock_handle (gpointer handle)
{
MonoW32HandleBase *handle_data;
-#ifdef DEBUG
- g_message ("%s: unlocking handle %p", __func__, handle);
-#endif
+ if (!mono_w32handle_lookup_data (handle, &handle_data))
+ g_error ("%s: failed to lookup handle %p", __func__, handle);
- if (!mono_w32handle_lookup_data (handle, &handle_data)) {
- return(0);
- }
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unlock handle %p", __func__, handle);
mono_os_mutex_unlock (&handle_data->signal_mutex);
mono_w32handle_unref (handle);
-
- return 0;
}
/*
g_free (private_handles [i]);
}
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type);
+
static void mono_w32handle_init_handle (MonoW32HandleBase *handle,
MonoW32HandleType type, gpointer handle_specific)
{
}
}
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data);
+
+void
+mono_w32handle_force_close (gpointer handle, gpointer data)
+{
+ mono_w32handle_ops_close (handle, data);
+}
+
void
mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops)
{
return (NULL);
}
-void mono_w32handle_ops_close (gpointer handle, gpointer data)
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-void mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
+static void
+mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
{
if (handle_ops[type] != NULL &&
handle_ops[type]->details != NULL) {
}
}
-const gchar* mono_w32handle_ops_typename (MonoW32HandleType type)
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type)
{
g_assert (handle_ops [type]);
g_assert (handle_ops [type]->typename);
return handle_ops [type]->typename ();
}
-gsize mono_w32handle_ops_typesize (MonoW32HandleType type)
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type)
{
g_assert (handle_ops [type]);
g_assert (handle_ops [type]->typesize);
return handle_ops [type]->typesize ();
}
-void mono_w32handle_ops_signal (gpointer handle)
+static void
+mono_w32handle_ops_signal (gpointer handle)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-gboolean mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
+static gboolean
+mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-gboolean mono_w32handle_ops_isowned (gpointer handle)
+static gboolean
+mono_w32handle_ops_isowned (gpointer handle)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-MonoW32HandleWaitRet
+static MonoW32HandleWaitRet
mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted)
{
MonoW32HandleBase *handle_data;
}
}
-void mono_w32handle_ops_prewait (gpointer handle)
+static void
+mono_w32handle_ops_prewait (gpointer handle)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
static void
spin (guint32 ms)
{
+#ifdef HOST_WIN32
+ SleepEx (ms, TRUE);
+#else
struct timespec sleepytime;
g_assert (ms < 1000);
sleepytime.tv_sec = 0;
sleepytime.tv_nsec = ms * 1000000;
nanosleep (&sleepytime, NULL);
+#endif /* HOST_WIN32 */
}
static void
mono_w32handle_lock_handles (gpointer *handles, gsize numhandles)
{
guint32 i, iter=0;
- int thr_ret;
/* Lock all the handles, with backoff */
again:
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: attempting to lock %p", __func__, handle);
- thr_ret = mono_w32handle_trylock_handle (handle);
-
- if (thr_ret != 0) {
+ if (!mono_w32handle_trylock_handle (handle)) {
/* Bummer */
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: attempt failed for %p: %s", __func__,
- handle, strerror (thr_ret));
+ handle);
while (i--) {
handle = handles[i];
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
}
/* If iter ever reaches 100 the nanosleep will
mono_w32handle_unlock_handles (gpointer *handles, gsize numhandles)
{
guint32 i;
- int thr_ret;
for(i=0; i<numhandles; i++) {
gpointer handle = handles[i];
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unlocking handle %p", __func__, handle);
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
}
}
MonoW32HandleWaitRet ret;
gboolean alerted;
gint64 start;
- gint thr_ret;
guint32 statuscode = 0;
alerted = FALSE;
return MONO_W32HANDLE_WAIT_RET_FAILED;
}
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
if (mono_w32handle_test_capabilities (handle, MONO_W32HANDLE_CAP_OWN)) {
if (own_if_owned (handle, &statuscode)) {
}
done:
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
return ret;
}
{
MonoW32HandleWaitRet ret;
gboolean alerted, poll;
- gint i, thr_ret;
+ gint i;
gint64 start;
gpointer handles_sorted [MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS];
guint32 statuscodes [MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS] = {0};
}
}
- thr_ret = mono_w32handle_lock_signal_mutex ();
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_signal_mutex ();
if (waitall) {
signalled = TRUE;
if (elapsed > timeout) {
ret = MONO_W32HANDLE_WAIT_RET_TIMEOUT;
- thr_ret = mono_w32handle_unlock_signal_mutex ();
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_signal_mutex ();
goto done;
}
}
}
- thr_ret = mono_w32handle_unlock_signal_mutex ();
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_signal_mutex ();
if (alerted) {
ret = MONO_W32HANDLE_WAIT_RET_ALERTED;
MonoW32HandleWaitRet ret;
gint64 start;
gboolean alerted;
- gint thr_ret;
guint32 statuscode = 0;
+ gpointer handles [2];
alerted = FALSE;
return MONO_W32HANDLE_WAIT_RET_FAILED;
}
- thr_ret = mono_w32handle_lock_handle (wait_handle);
- g_assert (thr_ret == 0);
+ handles [0] = wait_handle;
+ handles [1] = signal_handle;
+
+ mono_w32handle_lock_handles (handles, 2);
mono_w32handle_ops_signal (signal_handle);
+ mono_w32handle_unlock_handle (signal_handle);
+
if (mono_w32handle_test_capabilities (wait_handle, MONO_W32HANDLE_CAP_OWN)) {
if (own_if_owned (wait_handle, &statuscode)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p already owned",
}
done:
- thr_ret = mono_w32handle_unlock_handle (wait_handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (wait_handle);
return ret;
}
-
-#endif /* !defined(HOST_WIN32) */
MonoW32HandleType
mono_w32handle_get_type (gpointer handle);
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type);
+
gboolean
mono_w32handle_lookup (gpointer handle, MonoW32HandleType type, gpointer *handle_specific);
mono_w32handle_test_capabilities (gpointer handle, MonoW32HandleCapability caps);
void
-mono_w32handle_ops_close (gpointer handle, gpointer data);
-
-void
-mono_w32handle_ops_signal (gpointer handle);
-
-gboolean
-mono_w32handle_ops_own (gpointer handle, guint32 *statuscode);
-
-gboolean
-mono_w32handle_ops_isowned (gpointer handle);
-
-MonoW32HandleWaitRet
-mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted);
-
-void
-mono_w32handle_ops_prewait (gpointer handle);
-
-void
-mono_w32handle_ops_details (MonoW32HandleType type, gpointer data);
-
-const gchar*
-mono_w32handle_ops_typename (MonoW32HandleType type);
-
-gsize
-mono_w32handle_ops_typesize (MonoW32HandleType type);
+mono_w32handle_force_close (gpointer handle, gpointer data);
void
mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast);
gboolean
mono_w32handle_issignalled (gpointer handle);
-int
+void
mono_w32handle_lock_handle (gpointer handle);
-int
+gboolean
mono_w32handle_trylock_handle (gpointer handle);
-int
+void
mono_w32handle_unlock_handle (gpointer handle);
MonoW32HandleWaitRet
*statuscode = WAIT_OBJECT_0;
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
- g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+ g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, before: [tid: %p, recursion: %d], after: [tid: %p, recursion: %d], abandoned: %s",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
if (mutex_handle->recursion != 0) {
g_assert (pthread_equal (pthread_self (), mutex_handle->tid));
MonoW32HandleMutex *mutex_handle;
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
- g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+ g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: testing ownership %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
if (mutex_handle->recursion > 0 && pthread_equal (mutex_handle->tid, pthread_self ())) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p owned by %p",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self ());
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self ());
return TRUE;
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, tid: %p recursion: %d",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
return FALSE;
}
}
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pre-waiting %s handle %p, owned? %s",
- __func__, mono_w32handle_ops_typename (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
+ __func__, mono_w32handle_get_typename (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
}
/* The shared state is not locked when prewait methods are called */
static gpointer mutex_handle_create (MonoW32HandleMutex *mutex_handle, MonoW32HandleType type, gboolean owned)
{
gpointer handle;
- int thr_ret;
guint32 statuscode;
mutex_handle->tid = 0;
handle = mono_w32handle_new (type, mutex_handle);
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
- __func__, mono_w32handle_ops_typename (type));
+ __func__, mono_w32handle_get_typename (type));
SetLastError (ERROR_GEN_FAILURE);
return NULL;
}
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
if (owned)
mutex_handle_own (handle, type, &statuscode);
else
mono_w32handle_set_signal_state (handle, TRUE, FALSE);
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return handle;
}
{
MonoW32HandleMutex mutex_handle;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_MUTEX));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_MUTEX));
return mutex_handle_create (&mutex_handle, MONO_W32HANDLE_MUTEX, owned);
}
gchar *utf8_name;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDMUTEX));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDMUTEX));
/* w32 seems to guarantee that opening named objects can't race each other */
mono_w32handle_namespace_lock ();
MonoW32HandleType type;
MonoW32HandleMutex *mutex_handle;
pthread_t tid;
- int thr_ret;
gboolean ret;
if (handle == NULL) {
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p, tid: %p recursion: %d",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
tid = pthread_self ();
ret = FALSE;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: we don't own %s handle %p (owned by %ld, me %ld)",
- __func__, mono_w32handle_ops_typename (type), handle, (long)mutex_handle->tid, (long)tid);
+ __func__, mono_w32handle_get_typename (type), handle, (long)mutex_handle->tid, (long)tid);
} else {
ret = TRUE;
thread_disown_mutex (mono_thread_internal_current (), handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
mutex_handle->tid = 0;
mono_w32handle_set_signal_state (handle, TRUE, FALSE);
}
}
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
return ret;
}
MonoW32HandleMutex *mutex_handle;
MonoNativeThreadId tid;
gpointer handle;
- int thr_ret;
handle = g_ptr_array_index (internal->owned_mutexes, 0);
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
g_error ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoning %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
tid = MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid);
g_error ("%s: trying to release mutex %p acquired by thread %p from thread %p",
__func__, handle, (gpointer) mutex_handle->tid, (gpointer) tid);
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
mutex_handle->recursion = 0;
mutex_handle->tid = 0;
thread_disown_mutex (internal, handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoned %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
}
g_ptr_array_free (internal->owned_mutexes, TRUE);
HANDLE stderr_handle,STARTUPINFO *startinfo);
gboolean
-mono_process_create_process (MonoProcInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd,
+mono_process_create_process (MonoW32ProcessInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd,
guint32 creation_flags, gchar *env_vars, gunichar2 *dir, STARTUPINFO *start_info,
PROCESS_INFORMATION *process_info);
MonoBoolean
mono_icall_set_priority_class (gpointer handle, gint32 priorityClass);
+
+gboolean
+mono_process_win_enum_processes (DWORD *pids, DWORD count, DWORD *needed);
#endif /* !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
#endif /* __MONO_METADATA_PROCESS_INTERNALS_H__ */
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
+#include <mono/metadata/object-internals.h>
+#include "mono/metadata/w32process.h"
+#include "mono/metadata/w32process-internals.h"
#include "mono/metadata/w32process-win32-internals.h"
gboolean
HANDLE
ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
{
- HANDLE handle;
-
- /* GetCurrentProcess returns a pseudo-handle, so use
- * OpenProcess instead
- */
- handle = OpenProcess (PROCESS_ALL_ACCESS, TRUE, pid);
- if (handle == NULL)
- /* FIXME: Throw an exception */
- return NULL;
- return handle;
+ MonoError mono_error;
+ mono_error_init (&mono_error);
+
+ g_unsupported_api ("OpenProcess");
+
+ mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenProcess");
+ mono_error_set_pending_exception (&mono_error);
+
+ SetLastError (ERROR_NOT_SUPPORTED);
+
+ return NULL;
}
void
}
MonoBoolean
-ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoProcessStartInfo *proc_start_info, MonoProcInfo *process_info)
+ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info)
{
MonoError mono_error;
mono_error_init (&mono_error);
}
gboolean
-mono_process_create_process (MonoProcInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, guint32 creation_flags,
+mono_process_create_process (MonoW32ProcessInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, guint32 creation_flags,
gchar *env_vars, gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info)
{
MonoError mono_error;
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_process_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (process_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
if (!mono_w32handle_lookup (handle, type, (gpointer *)&sem_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
sem_handle->val--;
sem_handle_create (MonoW32HandleSemaphore *sem_handle, MonoW32HandleType type, gint32 initial, gint32 max)
{
gpointer handle;
- int thr_ret;
sem_handle->val = initial;
sem_handle->max = max;
handle = mono_w32handle_new (type, sem_handle);
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
- __func__, mono_w32handle_ops_typename (type));
+ __func__, mono_w32handle_get_typename (type));
SetLastError (ERROR_GEN_FAILURE);
return NULL;
}
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
if (initial != 0)
mono_w32handle_set_signal_state (handle, TRUE, FALSE);
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return handle;
}
{
MonoW32HandleSemaphore sem_handle;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_SEM), initial, max);
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_SEM), initial, max);
return sem_handle_create (&sem_handle, MONO_W32HANDLE_SEM, initial, max);
}
gchar *utf8_name;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d name \"%s\"",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDSEM), initial, max, (const char*)name);
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDSEM), initial, max, (const char*)name);
/* w32 seems to guarantee that opening named objects can't race each other */
mono_w32handle_namespace_lock ();
{
MonoW32HandleType type;
MonoW32HandleSemaphore *sem_handle;
- int thr_ret;
MonoBoolean ret;
if (!handle) {
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
- thr_ret = mono_w32handle_lock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_lock_handle (handle);
/* Do this before checking for count overflow, because overflowing
* max is a listed technique for finding the current value */
/* No idea why max is signed, but thats the spec :-( */
if (sem_handle->val + releaseCount > (guint32)sem_handle->max) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d, max value would be exceeded",
- __func__, mono_w32handle_ops_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+ __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
ret = FALSE;
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d",
- __func__, mono_w32handle_ops_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+ __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
sem_handle->val += releaseCount;
mono_w32handle_set_signal_state (handle, TRUE, TRUE);
ret = TRUE;
}
- thr_ret = mono_w32handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ mono_w32handle_unlock_handle (handle);
return ret;
}
#include <mono/metadata/mempool.h>
#include <mono/metadata/opcodes.h>
#include <mono/metadata/mempool-internals.h>
+#include <mono/utils/mono-compiler.h>
#include <config.h>
process_block (cfg, cfg->bblocks [0], &area);
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (abcremoval);
+
+#endif /* !DISABLE_JIT */
#include "mini.h"
#include "ir-emit.h"
#include "glib.h"
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
mono_print_code (cfg, "AFTER ALIAS_ANALYSIS");
}
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (alias_analysis);
+
#endif /* !DISABLE_JIT */
*/
#include "config.h"
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
#include "mini.h"
} while (changed && (niterations > 0));
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (branch_opts);
+
+#endif /* !DISABLE_JIT */
#include <mono/metadata/gc-internals.h>
#include <mono/metadata/abi-details.h>
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
}
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (decompose);
+
+#endif /* !DISABLE_JIT */
*/
#include "config.h"
+#include <mono/utils/mono-compiler.h>
#if !defined(DISABLE_AOT) && !defined(DISABLE_JIT)
#include "dwarfwriter.h"
emit_fde (w, w->fde_index, start_symbol, end_symbol, code, code_size, unwind_info, FALSE);
w->fde_index ++;
}
+
+#else /* !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */
+
+MONO_EMPTY_SOURCE_FILE (dwarfwriter);
+
#endif /* End of: !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */
*/
#include <config.h>
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
#endif
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (graph);
+
+#endif /* !DISABLE_JIT */
#include "mini.h"
#include <mono/metadata/debug-helpers.h>
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
g_list_free (inactive);
}
-#endif /* #ifndef DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (linear_scan);
+
+#endif /* !DISABLE_JIT */
*/
#include <config.h>
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
g_free (vreg_to_varinfo);
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (liveness);
+
+#endif /* !DISABLE_JIT */
*/
#include <config.h>
+#include <mono/utils/mono-compiler.h>
+
#ifndef DISABLE_JIT
#include <string.h>
//mono_print_code (cfg, "AFTER LOCAL-DEADCE");
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (local_propagation);
+
+#endif /* !DISABLE_JIT */
bundle_save_library_initialized = 1;
char *path = g_build_filename (g_get_tmp_dir (), "mono-bundle-XXXXXX", NULL);
bundled_dylibrary_directory = g_mkdtemp (path);
- /* don't free path - mkdtemp modifies it in place, and bundled_dylibrary_directory is an alias of it */
+ g_free (path);
if (bundled_dylibrary_directory == NULL)
return;
atexit (delete_bundled_libraries);
*/
#include <config.h>
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
the values on the stack before emitting the last instruction of the bb.
*/
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (method_to_ir);
+
+#endif /* !DISABLE_JIT */
#define MONO_WIN64_VALUE_TYPE_FITS_REG(arg_size) (arg_size <= SIZEOF_REGISTER && (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8))
static gboolean
-allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, AMD64_Reg_No int_regs [], int int_reg_count, AMD64_Reg_No float_regs [], int float_reg_count, guint32 *current_int_reg, guint32 *current_float_reg)
+allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, AMD64_Reg_No int_regs [], int int_reg_count, AMD64_XMM_Reg_No float_regs [], int float_reg_count, guint32 *current_int_reg, guint32 *current_float_reg)
{
gboolean result = FALSE;
static AMD64_Reg_No param_regs [] = { AMD64_RCX, AMD64_RDX, AMD64_R8, AMD64_R9 };
-static AMD64_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 };
+static AMD64_XMM_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 };
static AMD64_Reg_No return_regs [] = { AMD64_RAX };
-static AMD64_Reg_No float_return_regs [] = { AMD64_XMM0 };
+static AMD64_XMM_Reg_No float_return_regs [] = { AMD64_XMM0 };
#define PARAM_REGS G_N_ELEMENTS(param_regs)
#define FLOAT_PARAM_REGS G_N_ELEMENTS(float_param_regs)
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
void
mono_runtime_setup_stat_profiler (void)
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mini_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mini_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/mempool.h>
#include <mono/metadata/mempool-internals.h>
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
}
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (ssa);
+
+#endif /* !DISABLE_JIT */
#include "sgen/sgen-gc.h"
#include "sgen/sgen-layout-stats.h"
+#include <mono/utils/mono-compiler.h>
#ifdef SGEN_OBJECT_LAYOUT_STATISTICS
}
#else
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_sgen_layout_stats_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (sgen_layout_stats);
#endif /* SGEN_OBJECT_LAYOUT_STATISTICS */
#endif
$(COOP_DISABLED_TESTS) \
$(PROFILE_DISABLED_TESTS)
-DISABLED_TESTS_WRENCH= \
+# failing tests which we temporarily disable for PRs
+# so they don't interfere with other people's work
+DISABLED_TESTS_CI_PR = \
+ appdomain-threadpool-unload.exe \
+ appdomain-thread-abort.exe
+
+DISABLED_TESTS_CI= \
$(DISABLED_TESTS) \
- $(PLATFORM_DISABLED_TESTS_WRENCH) \
+ $(shell if [ "x$(CI_PR)" != "x" ]; then echo $(DISABLED_TESTS_CI_PR); fi) \
main-returns-background-resetabort.exe \
main-returns-background-abort-resetabort.exe \
thread6.exe \
@failed=0; \
passed=0; \
if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
- if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+ if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
for i in $(TESTSI_CS); do \
if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
then \
@failed=0; \
passed=0; \
if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
- if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+ if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
for i in $(TESTSI_IL); do \
if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
then \
testb: $(TEST_PROG) $(TESTBS)
if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
- if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+ if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
for i in $(TESTBS); do \
$(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
done
passed=0; \
failed_tests="";\
if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
- if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+ if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
rm -f testlist testlist.sorted; \
for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do echo $${i} >> testlist; sort testlist > testlist.sorted; done; \
for i in `cat testlist.sorted`; do \
fi
runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
- @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+ @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
$(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
- @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+ @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
$(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
testjit:
mono-dl-darwin.c \
mono-dl-posix.c \
mono-dl.h \
- mono-dl-windows.h \
+ mono-dl-windows-internals.h \
mono-log-windows.c \
mono-log-common.c \
mono-log-posix.c \
mono-mmap-windows.c \
mono-mmap.h \
mono-mmap-internals.h \
- mono-mmap-windows.h \
+ mono-mmap-windows-internals.h \
mono-os-mutex.h \
mono-coop-mutex.h \
mono-once.h \
mono-proclib.c \
mono-proclib-windows.c \
mono-proclib.h \
- mono-proclib-windows.h \
+ mono-proclib-windows-internals.h \
mono-publib.c \
mono-string.h \
mono-time.c \
mono-rand.c \
mono-rand-windows.c \
mono-rand.h \
- mono-rand-windows.h \
+ mono-rand-windows-internals.h \
memfuncs.c \
memfuncs.h \
parse.c \
#include <glib.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/mono-compiler.h>
#if defined (WAPI_NO_ATOMIC_ASM) || defined (BROKEN_64BIT_ATOMICS_INTRINSIC)
#endif
#endif
-#if defined(HOST_WIN32) && defined(_MSC_VER)
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_atomic_lnk4221(void) {}
+#if !defined (WAPI_NO_ATOMIC_ASM) && !defined (BROKEN_64BIT_ATOMICS_INTRINSIC) && !defined (NEED_64BIT_CMPXCHG_FALLBACK)
+MONO_EMPTY_SOURCE_FILE (atomic);
#endif
#endif /* _MSC_VER */
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+#define MONO_EMPTY_SOURCE_FILE(x) void __mono_win32_ ## x ## _quiet_lnk4221 (void) {}
+#else
+#define MONO_EMPTY_SOURCE_FILE(x)
+#endif
+
#if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN
#if MONO_LLVM_LOADED
#define MONO_LLVM_INTERNAL MONO_API
--- /dev/null
+#ifndef __MONO_UTILS_DL_WINDOWS_H__
+#define __MONO_UTILS_DL_WINDOWS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/utils/mono-dl.h"
+
+void*
+mono_dl_lookup_symbol_in_process (const char *symbol_name);
+#endif /* HOST_WIN32 */
+#endif /* __MONO_UTILS_DL_WINDOWS_H__ */
+
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
-#include "mono/utils/mono-dl-windows.h"
+#include <windows.h>
+#include "mono/utils/mono-dl-windows-internals.h"
void*
mono_dl_lookup_symbol_in_process (const char *symbol_name)
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_dl_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mono_dl_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
#if defined(HOST_WIN32)
#include "mono/utils/mono-dl.h"
-#include "mono/utils/mono-dl-windows.h"
+#include "mono/utils/mono-dl-windows-internals.h"
#include "mono/utils/mono-embed.h"
#include "mono/utils/mono-path.h"
+++ /dev/null
-#ifndef __MONO_UTILS_DL_WINDOWS_H__
-#define __MONO_UTILS_DL_WINDOWS_H__
-
-#include <config.h>
-#include <glib.h>
-
-#ifdef HOST_WIN32
-#include "mono/utils/mono-dl.h"
-
-void*
-mono_dl_lookup_symbol_in_process (const char *symbol_name);
-#endif /* HOST_WIN32 */
-#endif /* __MONO_UTILS_DL_WINDOWS_H__ */
-
#include <errno.h>
#include <mono/utils/mono-io-portability.h>
#include <mono/metadata/profiler-private.h>
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_PORTABILITY
#else /* DISABLE_PORTABILITY */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_io_portability_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mono_io_portability);
+
#endif /* DISABLE_PORTABILITY */
--- /dev/null
+#ifndef __MONO_UTILS_MMAP_WINDOWS_H__
+#define __MONO_UTILS_MMAP_WINDOWS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/utils/mono-mmap.h"
+#include "mono/utils/mono-mmap-internals.h"
+
+int
+mono_mmap_win_prot_from_flags (int flags);
+#endif /* HOST_WIN32 */
+#endif /* __MONO_UTILS_MMAP_WINDOWS_H__ */
+
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
-#include <mono/utils/mono-mmap-windows.h>
+#include <windows.h>
+#include <mono/utils/mono-mmap-windows-internals.h>
void*
mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle)
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_mmap_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mono_mmap_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
#if defined(HOST_WIN32)
#include <windows.h>
-#include "mono/utils/mono-mmap-windows.h"
+#include "mono/utils/mono-mmap-windows-internals.h"
#include <mono/utils/mono-counters.h>
#include <io.h>
+++ /dev/null
-#ifndef __MONO_UTILS_MMAP_WINDOWS_H__
-#define __MONO_UTILS_MMAP_WINDOWS_H__
-
-#include <config.h>
-#include <glib.h>
-
-#ifdef HOST_WIN32
-#include "mono/utils/mono-mmap.h"
-#include "mono/utils/mono-mmap-internals.h"
-
-int
-mono_mmap_win_prot_from_flags (int flags);
-#endif /* HOST_WIN32 */
-#endif /* __MONO_UTILS_MMAP_WINDOWS_H__ */
-
--- /dev/null
+#ifndef __MONO_UTILS_PROCLIB_WINDOWS_H__
+#define __MONO_UTILS_PROCLIB_WINDOWS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include <process.h>
+#include "mono/utils/mono-proclib.h"
+
+#endif /* HOST_WIN32 */
+#endif /* __MONO_UTILS_PROCLIB_WINDOWS_H__ */
+
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
#include <mono/utils/mono-proclib.h>
gint32
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_proclib_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mono_proclib_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+++ /dev/null
-#ifndef __MONO_UTILS_PROCLIB_WINDOWS_H__
-#define __MONO_UTILS_PROCLIB_WINDOWS_H__
-
-#include <config.h>
-#include <glib.h>
-
-#ifdef HOST_WIN32
-#include <process.h>
-#include "mono/utils/mono-proclib.h"
-
-#endif /* HOST_WIN32 */
-#endif /* __MONO_UTILS_PROCLIB_WINDOWS_H__ */
-
--- /dev/null
+#ifndef _MONO_UTILS_RAND_WINDOWS_H_
+#define _MONO_UTILS_RAND_WINDOWS_H_
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <wincrypt.h>
+#define MONO_WIN32_CRYPT_PROVIDER_HANDLE HCRYPTPROV
+
+#else
+
+#include <bcrypt.h>
+#define MONO_WIN32_CRYPT_PROVIDER_HANDLE BCRYPT_ALG_HANDLE
+#endif
+
+MONO_WIN32_CRYPT_PROVIDER_HANDLE
+mono_rand_win_open_provider (void);
+
+gboolean
+mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size);
+
+gboolean
+mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size);
+
+void
+mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider);
+
+#endif /* HOST_WIN32 */
+#endif /* _MONO_UTILS_RAND_WINDOWS_H_ */
+
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
-#include "mono/utils/mono-rand-windows.h"
+#include <windows.h>
+#include "mono/utils/mono-rand-windows-internals.h"
MONO_WIN32_CRYPT_PROVIDER_HANDLE
mono_rand_win_open_provider (void)
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_rand_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mono_rand_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
#if defined(HOST_WIN32)
#include <windows.h>
-#include "mono/utils/mono-rand-windows.h"
+#include "mono/utils/mono-rand-windows-internals.h"
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#ifndef PROV_INTEL_SEC
+++ /dev/null
-#ifndef _MONO_UTILS_RAND_WINDOWS_H_
-#define _MONO_UTILS_RAND_WINDOWS_H_
-
-#include <config.h>
-#include <glib.h>
-
-#ifdef HOST_WIN32
-
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#include <wincrypt.h>
-#define MONO_WIN32_CRYPT_PROVIDER_HANDLE HCRYPTPROV
-
-#else
-
-#include <bcrypt.h>
-#define MONO_WIN32_CRYPT_PROVIDER_HANDLE BCRYPT_ALG_HANDLE
-#endif
-
-MONO_WIN32_CRYPT_PROVIDER_HANDLE
-mono_rand_win_open_provider (void);
-
-gboolean
-mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size);
-
-gboolean
-mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size);
-
-void
-mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider);
-
-#endif /* HOST_WIN32 */
-#endif /* _MONO_UTILS_RAND_WINDOWS_H_ */
-
*/
#include <mono/utils/networking.h>
+#include <mono/utils/mono-compiler.h>
#include <glib.h>
#ifdef HAVE_NETDB_H
#else /* !HAVE_INET_PTON */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_networking_missing_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (networking_missing);
#endif /* !HAVE_INET_PTON */
static mono_lazy_init_t status = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
static mono_mutex_t signal_mutex;
-static mono_cond_t signal_cond;
static void
initialize (void)
{
mono_os_mutex_init (&signal_mutex);
- mono_os_cond_init (&signal_cond);
}
void
mono_lazy_initialize (&status, initialize);
- mono_os_mutex_init (&event->mutex);
- mono_os_cond_init (&event->cond);
+ event->conds = g_ptr_array_new ();
event->signalled = initial;
}
g_assert (event);
- mono_os_mutex_destroy (&event->mutex);
- mono_os_cond_destroy (&event->cond);
+ if (event->conds->len > 0)
+ g_error ("%s: cannot destroy osevent, there are still %d threads waiting on it", __func__, event->conds->len);
+
+ g_ptr_array_free (event->conds, TRUE);
}
static gboolean
void
mono_os_event_set (MonoOSEvent *event)
{
+ gsize i;
+
g_assert (mono_lazy_is_initialized (&status));
g_assert (event);
- mono_os_mutex_lock (&event->mutex);
mono_os_mutex_lock (&signal_mutex);
event->signalled = TRUE;
- mono_os_cond_broadcast (&event->cond);
- mono_os_cond_broadcast (&signal_cond);
+ for (i = 0; i < event->conds->len; ++i)
+ mono_os_cond_signal ((mono_cond_t*) event->conds->pdata [i]);
- mono_os_mutex_unlock (&event->mutex);
mono_os_mutex_unlock (&signal_mutex);
}
g_assert (event);
- mono_os_mutex_lock (&event->mutex);
+ mono_os_mutex_lock (&signal_mutex);
event->signalled = FALSE;
- mono_os_mutex_unlock (&event->mutex);
+ mono_os_mutex_unlock (&signal_mutex);
}
MonoOSEventWaitRet
}
}
-static void
-mono_os_event_lock_events (MonoOSEvent **events, gsize nevents)
-{
- gint i, j;
-
-retry:
- for (i = 0; i < nevents; ++i) {
- gint res;
-
- res = mono_os_mutex_trylock (&events [i]->mutex);
- if (res != 0) {
- for (j = i - 1; j >= 0; j--)
- mono_os_mutex_unlock (&events [j]->mutex);
-
- mono_thread_info_yield ();
-
- goto retry;
- }
- }
-}
-
-static void
-mono_os_event_unlock_events (MonoOSEvent **events, gsize nevents)
-{
- gint i;
-
- for (i = 0; i < nevents; ++i)
- mono_os_mutex_unlock (&events [i]->mutex);
-}
-
MonoOSEventWaitRet
mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waitall, guint32 timeout)
{
MonoOSEventWaitRet ret;
- MonoOSEvent *innerevents [MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS + 1];
+ mono_cond_t signal_cond;
OSEventWaitData *data;
gboolean alerted;
gint64 start;
for (i = 0; i < nevents; ++i)
g_assert (events [i]);
- memcpy (innerevents, events, sizeof (MonoOSEvent*) * nevents);
-
data = g_new0 (OSEventWaitData, 1);
data->ref = 2;
mono_os_event_init (&data->event, FALSE);
- innerevents [nevents ++] = &data->event;
-
alerted = FALSE;
mono_thread_info_install_interrupt (signal_and_unref, data, &alerted);
if (alerted) {
if (timeout != MONO_INFINITE_WAIT)
start = mono_msec_ticks ();
+ mono_os_cond_init (&signal_cond);
+
+ mono_os_mutex_lock (&signal_mutex);
+
+ for (i = 0; i < nevents; ++i)
+ g_ptr_array_add (events [i]->conds, &signal_cond);
+
+ g_ptr_array_add (data->event.conds, &signal_cond);
+
for (;;) {
gint count, lowest;
gboolean signalled;
- mono_os_event_lock_events (innerevents, nevents);
-
count = 0;
lowest = -1;
- for (i = 0; i < nevents - 1; ++i) {
- if (mono_os_event_is_signalled (innerevents [i])) {
+ for (i = 0; i < nevents; ++i) {
+ if (mono_os_event_is_signalled (events [i])) {
count += 1;
if (lowest == -1)
lowest = i;
if (mono_os_event_is_signalled (&data->event))
signalled = TRUE;
else if (waitall)
- signalled = (count == nevents - 1);
+ signalled = (count == nevents);
else /* waitany */
signalled = (count > 0);
- mono_os_event_unlock_events (innerevents, nevents);
-
if (signalled) {
ret = MONO_OS_EVENT_WAIT_RET_SUCCESS_0 + lowest;
goto done;
}
- mono_os_mutex_lock (&signal_mutex);
-
- if (mono_os_event_is_signalled (&data->event)) {
- signalled = TRUE;
- } else if (waitall) {
- signalled = TRUE;
- for (i = 0; i < nevents - 1; ++i) {
- if (!mono_os_event_is_signalled (innerevents [i])) {
- signalled = FALSE;
- break;
- }
- }
- } else {
- signalled = FALSE;
- for (i = 0; i < nevents - 1; ++i) {
- if (mono_os_event_is_signalled (innerevents [i])) {
- signalled = TRUE;
- break;
- }
- }
- }
-
- if (signalled) {
- mono_os_mutex_unlock (&signal_mutex);
- continue;
- }
-
if (timeout == MONO_INFINITE_WAIT) {
mono_os_cond_wait (&signal_cond, &signal_mutex);
} else {
elapsed = mono_msec_ticks () - start;
if (elapsed >= timeout) {
- mono_os_mutex_unlock (&signal_mutex);
-
ret = MONO_OS_EVENT_WAIT_RET_TIMEOUT;
goto done;
}
res = mono_os_cond_timedwait (&signal_cond, &signal_mutex, timeout - elapsed);
if (res != 0) {
- mono_os_mutex_unlock (&signal_mutex);
-
ret = MONO_OS_EVENT_WAIT_RET_TIMEOUT;
goto done;
}
}
-
- mono_os_mutex_unlock (&signal_mutex);
}
done:
+ for (i = 0; i < nevents; ++i)
+ g_ptr_array_remove (events [i]->conds, &signal_cond);
+
+ g_ptr_array_remove (data->event.conds, &signal_cond);
+
+ mono_os_mutex_unlock (&signal_mutex);
+
+ mono_os_cond_destroy (&signal_cond);
+
mono_thread_info_uninstall_interrupt (&alerted);
if (alerted) {
if (InterlockedDecrement ((gint32*) &data->ref) == 0) {
#ifdef HOST_WIN32
gpointer handle;
#else
- mono_mutex_t mutex;
- mono_cond_t cond;
+ GPtrArray *conds;
gboolean signalled;
#endif
};
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup Label="ProjectConfigurations">\r
<ProjectConfiguration Include="Debug|Win32">\r
<ClCompile Include="..\eglib\src\gstr.c" />\r
<ClCompile Include="..\eglib\src\gstring.c" />\r
<ClCompile Include="..\eglib\src\gtimer-win32.c" />\r
+ <ClCompile Include="..\eglib\src\gunicode-win32.c" />\r
<ClCompile Include="..\eglib\src\gunicode.c" />\r
<ClCompile Include="..\eglib\src\gutf8.c" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\eglib\src\glib.h" />\r
+ <ClInclude Include="..\eglib\src\gmodule-win32-internals.h" />\r
<ClInclude Include="..\eglib\src\gmodule.h" />\r
<ClInclude Include="..\eglib\src\sort.frag.h" />\r
</ItemGroup>\r
<Project>{92ae7622-5f58-4234-9a26-9ec71876b3f4}</Project>\r
</ProjectReference>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\eglib\src\Makefile.am" />\r
+ </ItemGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>\r
+</Project>
\ No newline at end of file
<ClCompile Include="..\eglib\src\gutf8.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\src\vasprintf.c">\r
+ <ClCompile Include="..\eglib\src\gunicode-win32.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
</ItemGroup>\r
<ClInclude Include="..\eglib\src\sort.frag.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\eglib\src\gmodule-win32-internals.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<Filter Include="Source Files">\r
<UniqueIdentifier>{38a39ff1-842b-431b-b54b-24094e8283eb}</UniqueIdentifier>\r
</Filter>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\eglib\src\Makefile.am">\r
+ <Filter>Resource Files</Filter>\r
+ </None>\r
+ </ItemGroup>\r
</Project>
\ No newline at end of file
<Project>{8fc2b0c8-51ad-49df-851f-5d01a77a75e4}</Project>\r
</ProjectReference>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\mono\mini\Makefile.am.in" />\r
+ </ItemGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
<UniqueIdentifier>{5370c3c4-b6ec-4f8a-8b21-ce4e782720a6}</UniqueIdentifier>\r
</Filter>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\mono\mini\Makefile.am.in">\r
+ <Filter>Resource Files</Filter>\r
+ </None>\r
+ </ItemGroup>\r
</Project>
\ No newline at end of file
<Project>{158073ed-99ae-4196-9edc-ddb2344f8466}</Project>\r
</ProjectReference>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\mono\metadata\Makefile.am" />\r
+ </ItemGroup>\r
<PropertyGroup Label="Globals">\r
<ProjectGuid>{C36612BD-22D3-4B95-85E2-7FDC4FC5D739}</ProjectGuid>\r
<Keyword>Win32Proj</Keyword>\r
<UniqueIdentifier>{e37c9a88-bfb3-47dd-948c-a74dea25b3ad}</UniqueIdentifier>\r
</Filter>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\mono\metadata\Makefile.am">\r
+ <Filter>Resource Files</Filter>\r
+ </None>\r
+ </ItemGroup>\r
</Project>
\ No newline at end of file
<ClInclude Include="..\mono\utils\mono-counters.h" />\r
<ClInclude Include="..\mono\utils\mono-digest.h" />\r
<ClInclude Include="..\mono\utils\mono-dl-fallback.h" />\r
- <ClInclude Include="..\mono\utils\mono-dl-windows.h" />\r
+ <ClInclude Include="..\mono\utils\mono-dl-windows-internals.h" />\r
<ClInclude Include="..\mono\utils\mono-dl.h" />\r
<ClInclude Include="..\mono\utils\mono-error-internals.h" />\r
<ClInclude Include="..\mono\utils\mono-error.h" />\r
<ClInclude Include="..\mono\utils\mono-math.h" />\r
<ClInclude Include="..\mono\utils\mono-membar.h" />\r
<ClInclude Include="..\mono\utils\mono-memory-model.h" />\r
- <ClInclude Include="..\mono\utils\mono-mmap-windows.h" />\r
+ <ClInclude Include="..\mono\utils\mono-mmap-internals.h" />\r
+ <ClInclude Include="..\mono\utils\mono-mmap-windows-internals.h" />\r
<ClInclude Include="..\mono\utils\mono-mmap.h" />\r
<ClInclude Include="..\mono\utils\mono-networkinterfaces.h" />\r
<ClInclude Include="..\mono\utils\mono-once.h" />\r
<ClInclude Include="..\mono\utils\mono-os-semaphore.h" />\r
<ClInclude Include="..\mono\utils\mono-path.h" />\r
<ClInclude Include="..\mono\utils\mono-poll.h" />\r
- <ClInclude Include="..\mono\utils\mono-proclib-windows.h" />\r
+ <ClInclude Include="..\mono\utils\mono-proclib-windows-internals.h" />\r
<ClInclude Include="..\mono\utils\mono-proclib.h" />\r
<ClInclude Include="..\mono\utils\mono-property-hash.h" />\r
<ClInclude Include="..\mono\utils\mono-publib.h" />\r
- <ClInclude Include="..\mono\utils\mono-rand-windows.h" />\r
+ <ClInclude Include="..\mono\utils\mono-rand-windows-internals.h" />\r
<ClInclude Include="..\mono\utils\mono-rand.h" />\r
<ClInclude Include="..\mono\utils\mono-sigcontext.h" />\r
<ClInclude Include="..\mono\utils\mono-stack-unwinding.h" />\r
<Project>{158073ed-99ae-4196-9edc-ddb2344f8466}</Project>\r
</ProjectReference>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\mono\utils\Makefile.am" />\r
+ </ItemGroup>\r
<PropertyGroup Label="Globals">\r
<ProjectGuid>{8FC2B0C8-51AD-49DF-851F-5D01A77A75E4}</ProjectGuid>\r
<Keyword>Win32Proj</Keyword>\r
<ClInclude Include="..\mono\utils\valgrind.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\mono\utils\mono-rand-windows.h">\r
+ <ClInclude Include="..\mono\utils\mono-mmap-windows-internals.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\mono\utils\mono-dl-windows.h">\r
+ <ClInclude Include="..\mono\utils\mono-mmap-internals.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\mono\utils\mono-mmap-windows.h">\r
+ <ClInclude Include="..\mono\utils\mono-proclib-windows-internals.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\mono\utils\mono-proclib-windows.h">\r
+ <ClInclude Include="..\mono\utils\mono-rand-windows-internals.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\mono\utils\mono-dl-windows-internals.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<ClInclude Include="..\mono\utils\os-event.h">\r
<Filter>Resource Files</Filter>\r
</MASM>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="..\mono\utils\Makefile.am">\r
+ <Filter>Resource Files</Filter>\r
+ </None>\r
+ </ItemGroup>\r
</Project>
\ No newline at end of file
mono_disasm_code_one
mono_dl_fallback_register
mono_dl_fallback_unregister
-mono_dl_open
mono_dllmap_insert
mono_domain_add_class_static_data
mono_domain_assembly_open
mono_ldtoken
mono_load_remote_field
mono_load_remote_field_new
-mono_loader_register_module
mono_lock_free_alloc
mono_lock_free_allocator_check_consistency
mono_lock_free_allocator_init_allocator
Mono_Posix_ToSyslogOptions\r
Mono_Posix_ToWaitOptions\r
Mono_Posix_ToXattrFlags\r
+Mono_Unix_VersionString\r
CreateZStream\r
CloseZStream\r
ReadZStream\r
mono_disasm_code_one
mono_dl_fallback_register
mono_dl_fallback_unregister
-mono_dl_open
mono_dllmap_insert
mono_domain_add_class_static_data
mono_domain_assembly_open
mono_ldtoken
mono_load_remote_field
mono_load_remote_field_new
-mono_loader_register_module
mono_lock_free_alloc
mono_lock_free_allocator_check_consistency
mono_lock_free_allocator_init_allocator
<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<resources></resources>
<response>monolinker.exe.sources</response>
</project>
- <project dir="tools/tuner" library="Mono.Tuner-net_4_x">
- <boot>false</boot>
- <flags>/codepage:65001 -r:./../../class/lib/net_4_x/monolinker.exe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Cecil.dll</flags>
- <output>Mono.Tuner.dll</output>
- <built_sources></built_sources>
- <library_output>./../../class/lib/net_4_x/Mono.Tuner.dll</library_output>
- <fx_version>4.5</fx_version>
- <profile>net_4_x</profile>
- <resources></resources>
- <response>Mono.Tuner.dll.sources</response>
- </project>
<project dir="tools/culevel" library="culevel-net_4_x">
<boot></boot>
<flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml</flags>
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monolinker-net_4_x", "mcs/tools/linker/monolinker-net_4_x.csproj", "{FA920637-C202-4E75-AC0F-1A8DBD631DF1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Tuner-net_4_x", "mcs/tools/tuner/Mono.Tuner-net_4_x.csproj", "{8CCE7044-3466-4599-B09E-9F8E0C2F4614}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "genxs-net_4_x", "mcs/tools/genxs/genxs-net_4_x.csproj", "{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mkbundle-net_4_x", "mcs/tools/mkbundle/mkbundle-net_4_x.csproj", "{3A3DAEC2-3DF4-4968-A191-8D6F207ABA5E}"
{FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.Build.0 = Release|Any CPU
- {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Release|Any CPU.Build.0 = Release|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Release|Any CPU.ActiveCfg = Release|Any CPU
export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k check check-seq-points EMIT_NUNIT=1
-${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1
+${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 CI_PR=${ghprbPullId}
${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check
${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test
${TESTCMD} --label=System.Data.OracleClient --timeout=5m make -w -C mcs/class/System.Data.OracleClient run-test;
${TESTCMD} --label=System.Design --timeout=5m make -w -C mcs/class/System.Design run-test;
-${TESTCMD} --label=Mono.Posix --timeout=5m make -w -C mcs/class/Mono.Posix run-test
+if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Mono.Posix --skip; else ${TESTCMD} --label=Mono.Posix --timeout=5m make -w -C mcs/class/Mono.Posix run-test; fi
${TESTCMD} --label=System.Web --timeout=30m make -w -C mcs/class/System.Web run-test
${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test
${TESTCMD} --label=System.Runtime.SFS --timeout=5m make -w -C mcs/class/System.Runtime.Serialization.Formatters.Soap run-test;
${TESTCMD} --label=System.Runtime.Remoting --timeout=5m make -w -C mcs/class/System.Runtime.Remoting run-test
${TESTCMD} --label=Cscompmgd --timeout=5m make -w -C mcs/class/Cscompmgd run-test;
${TESTCMD} --label=Commons.Xml.Relaxng --timeout=5m make -w -C mcs/class/Commons.Xml.Relaxng run-test;
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=System.ServiceProcess --skip; else ${TESTCMD} --label=System.ServiceProcess --timeout=5m make -w -C mcs/class/System.ServiceProcess run-test; fi
+${TESTCMD} --label=System.ServiceProcess --timeout=5m make -w -C mcs/class/System.ServiceProcess run-test
${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test
${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test
${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test
.stamp-clone:
@if [ ! -d $(CPPSHARP_BASE_DIR) ]; then \
- git clone -b 60f763a9 --depth 1 git://github.com/xamarin/CppSharpBinaries.git $(CPPSHARP_DIR) && touch $@; \
+ git clone -b 60f763a9 --depth 1 git://github.com/xamarin/CppSharpBinaries.git $(CPPSHARP_BASE_DIR) && touch $@; \
fi
MonoAotOffsetsDumper.exe: .stamp-clone MonoAotOffsetsDumper.cs $(MONO_OPTIONS_SRC)
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 1
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+ #error Unsupported WINAPI family
+#endif
#else
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 0
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+ #error Unsupported WINAPI family
+#endif
#endif
#endif