Merge branch 'master' into mono-2018-06

This commit is contained in:
Marek Safar 2018-07-10 10:41:51 +02:00
Родитель 95bcaa9124 4f0bac5161
Коммит 69f8d32ea6
48 изменённых файлов: 502 добавлений и 141 удалений

Просмотреть файл

@ -50,7 +50,7 @@ IOS_PRODUCT=Xamarin.iOS
IOS_PACKAGE_NAME=Xamarin.iOS
IOS_PACKAGE_NAME_LOWER=$(shell echo $(IOS_PACKAGE_NAME) | tr "[:upper:]" "[:lower:]")
# NEVER customize IOS_PACKAGE_VERSION itself, other parts (mtouch, web updater) are using the IOS_PACKAGE_VERSION_* variables
IOS_PACKAGE_VERSION=11.13.$(PACKAGE_VERSION_REV).$(IOS_COMMIT_DISTANCE)
IOS_PACKAGE_VERSION=11.15.$(PACKAGE_VERSION_REV).$(IOS_COMMIT_DISTANCE)
IOS_PACKAGE_VERSION_MAJOR=$(word 1, $(subst ., ,$(IOS_PACKAGE_VERSION)))
IOS_PACKAGE_VERSION_MINOR=$(word 2, $(subst ., ,$(IOS_PACKAGE_VERSION)))
IOS_PACKAGE_VERSION_REV=$(PACKAGE_VERSION_REV)
@ -264,7 +264,7 @@ MAC_PRODUCT=Xamarin.Mac
MAC_PACKAGE_NAME=xamarin.mac
MAC_PACKAGE_NAME_LOWER=$(shell echo $(MAC_PACKAGE_NAME) | tr "[:upper:]" "[:lower:]")
MAC_PACKAGE_VERSION=4.5.$(PACKAGE_VERSION_REV).$(MAC_COMMIT_DISTANCE)
MAC_PACKAGE_VERSION=4.7.$(PACKAGE_VERSION_REV).$(MAC_COMMIT_DISTANCE)
MAC_PACKAGE_VERSION_MAJOR=$(word 1, $(subst ., ,$(MAC_PACKAGE_VERSION)))
MAC_PACKAGE_VERSION_MINOR=$(word 2, $(subst ., ,$(MAC_PACKAGE_VERSION)))
MAC_PACKAGE_VERSION_REV=$(PACKAGE_VERSION_REV)

Просмотреть файл

@ -472,8 +472,37 @@ argument in the project's Mac Build options.
### <a name="MM8026"/>MM8026: * is not supported when the dynamic registrar has been linked away.
This usually indicates a bug in Xamarin.Mac, because the dynamic registrar should not be linked away if it's needed. Please file a bug at [https://bugzilla.xamarin.com](https://bugzilla.xamarin.com/enter_bug.cgi?product=iOS).
This usually indicates a bug in Xamarin.Mac, because the dynamic registrar should not be linked away if it's needed. Please file a bug at [https://bugzilla.xamarin.com](https://bugzilla.xamarin.com/enter_bug.cgi?product=Xamarin.Mac).
It's possible to force the linker to keep the dynamic registrar by adding
`--optimize=-remove-dynamic-registrar` to the additional mmp arguments in
the project's Mac Build options.
### <a name="MT8027"/>MT8027: Failed to marshal the Objective-C object {handle} (type: {managed_type}). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance.
This occurs when the Xamarin.Mac runtime finds an Objective-C object without a
corresponding managed wrapper object, and when trying to create that managed
wrapper, it turns out it's not possible.
There are a few reasons this may happen:
* If it occurs when deserializing a storyboard/nib/xib and mentioning a
managed type that's used in that storyboard/nib/xib, then the fix is to add
a constructor that takes a single `IntPtr` argument to that managed type.
This constructor should not have any logic (because it's invoked before the
native and managed instances are fully created).
* A managed wrapper existed at some point, but was collected by the GC. If the
native object is still alive, and later resurfaces to managed code, the
Xamarin.Mac runtime will try to re-create a managed wrapper instance. In
most cases the problem here is that the managed wrapper shouldn't have been
collected by the GC in the first place.
Possible causes include:
* Manually calling Dispose too early on the managed wrapper.
* Incorrect bindings for third-party libraries.
* Reference-counting bugs in third-party libraries.
* It could be a bug in Xamarin.Mac. If this is the case, please file a bug at
[https://bugzilla.xamarin.com](https://bugzilla.xamarin.com/enter_bug.cgi?product=Xamarin.Mac).

Просмотреть файл

@ -2482,3 +2482,32 @@ This usually indicates a bug in Xamarin.iOS, because the dynamic registrar shoul
It's possible to force the linker to keep the dynamic registrar by adding
`--optimize=-remove-dynamic-registrar` to the additional mtouch arguments in
the project's iOS Build options.
### <a name="MM8027"/>MM8027: Failed to marshal the Objective-C object {handle} (type: {managed_type}). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance.
This occurs when the Xamarin.iOS runtime finds an Objective-C object without a
corresponding managed wrapper object, and when trying to create that managed
wrapper, it turns out it's not possible.
There are a few reasons this may happen:
* If it occurs when deserializing a storyboard/nib/xib and mentioning a
managed type that's used in that storyboard/nib/xib, then the fix is to add
a constructor that takes a single `IntPtr` argument to that managed type.
This constructor should not have any logic (because it's invoked before the
native and managed instances are fully created).
* A managed wrapper existed at some point, but was collected by the GC. If the
native object is still alive, and later resurfaces to managed code, the
Xamarin.iOS runtime will try to re-create a managed wrapper instance. In
most cases the problem here is that the managed wrapper shouldn't have been
collected by the GC in the first place.
Possible causes include:
* Manually calling Dispose too early on the managed wrapper.
* Incorrect bindings for third-party libraries.
* Reference-counting bugs in third-party libraries.
* It could be a bug in Xamarin.iOS. If this is the case, please file a bug at
[https://bugzilla.xamarin.com](https://bugzilla.xamarin.com/enter_bug.cgi?product=iOS).

2
external/mono поставляемый

@ -1 +1 @@
Subproject commit 7627a5f9eeba0fd846731ad0c498556f55be1a34
Subproject commit 6e514dcc645ef70d53ab2a34266005d4ad875c73

20
jenkins/Jenkinsfile поставляемый
Просмотреть файл

@ -16,6 +16,8 @@ currentStage = null
xiPackageFilename = null
xmPackageFilename = null
msbuildZipFilename = null
bundleZipFilename = null
manifestFilename = null
artifactsFilename = null
reportPrefix = null
@ -271,6 +273,12 @@ timestamps {
xmPackageFilename = xmPackages [0].name
echo ("Created Xamarin.Mac package: ${xmPackageFilename}")
}
def msbuildZip = findFiles (glob: "package/msbuild.zip")
if (msbuildZip.length > 0)
msbuildZipFilename = msbuildZip [0].name
def bundleZip = findFiles (glob: "package/bundle.zip")
if (bundleZip.length > 0)
bundleZipFilename = bundleZip [0].name
withCredentials ([string (credentialsId: 'codesign_keychain_pw', variable: 'PRODUCTSIGN_KEYCHAIN_PASSWORD')]) {
sh ("${workspace}/xamarin-macios/jenkins/productsign.sh")
}
@ -326,11 +334,11 @@ timestamps {
utils = load ("${workspace}/xamarin-macios/jenkins/utils.groovy")
if (xiPackageFilename != null) {
xiPackageUrl = "${packagePrefix}/${xiPackageFilename}"
utils.reportGitHubStatus (gitHash, 'jenkins-PKG-Xamarin.iOS', "${xiPackageUrl}", 'SUCCESS', "${xiPackageFilename}")
utils.reportGitHubStatus (gitHash, 'PKG-Xamarin.iOS', "${xiPackageUrl}", 'SUCCESS', "${xiPackageFilename}")
}
if (xmPackageFilename != null) {
xmPackageUrl = "${packagePrefix}/${xmPackageFilename}"
utils.reportGitHubStatus (gitHash, 'jenkins-PKG-Xamarin.Mac', "${xmPackageUrl}", 'SUCCESS', "${xmPackageFilename}")
utils.reportGitHubStatus (gitHash, 'PKG-Xamarin.Mac', "${xmPackageUrl}", 'SUCCESS', "${xmPackageFilename}")
}
if (manifestFilename != null) {
def manifestUrl = "${packagePrefix}/${manifestFilename}"
@ -340,6 +348,14 @@ timestamps {
def artifactUrl = "${packagePrefix}/${artifactsFilename}"
utils.reportGitHubStatus (gitHash, "Jenkins: Artifacts", "${artifactUrl}", 'SUCCESS', "${artifactsFilename}")
}
if (bundleZipFilename != null) {
def bundleZipUrl = "${packagePrefix}/${bundleZipFilename}"
utils.reportGitHubStatus (gitHash, "bundle.zip", "${bundleZipUrl}", 'SUCCESS', "${bundleZipFilename}")
}
if (msbuildZipFilename != null) {
def msbuildZipUrl = "${packagePrefix}/${msbuildZipFilename}"
utils.reportGitHubStatus (gitHash, "msbuild.zip", "${msbuildZipUrl}", 'SUCCESS', "${msbuildZipFilename}")
}
}
dir ('xamarin-macios') {

Просмотреть файл

@ -18,7 +18,12 @@ if test -d "$DEPENDENCY_PATH"; then
if ! git log -1 --pretty=%H "$DEPENDENCY_HASH" > /dev/null 2>&1; then
echo "*** [$DEPENDENCY_NAME] git fetch $DEPENDENCY_REMOTE"
git fetch "$DEPENDENCY_REMOTE"
elif ! git rev-parse --verify "$DEPENDENCY_REMOTE/$DEPENDENCY_BRANCH" > /dev/null 2>&1; then
# Also check if we have the branch we need, we might already have the hash, but not the branch
echo "*** [$DEPENDENCY_NAME] git fetch $DEPENDENCY_REMOTE"
git fetch "$DEPENDENCY_REMOTE"
fi
else
echo "*** [$DEPENDENCY_NAME] git clone $DEPENDENCY_MODULE --recursive $DEPENDENCY_DIRECTORY -b $DEPENDENCY_BRANCH --origin $DEPENDENCY_REMOTE"
mkdir -p "$(dirname "$DEPENDENCY_PATH")"
@ -30,6 +35,9 @@ fi
if ! git log -1 --pretty=%H "$DEPENDENCY_HASH" > /dev/null 2>&1; then
echo "The hash $DEPENDENCY_HASH does not exist in $DEPENDENCY_MODULE. Please verify that you pushed your changes."
exit 1
elif ! git rev-parse --verify "$DEPENDENCY_REMOTE/$DEPENDENCY_BRANCH" > /dev/null 2>&1; then
echo "The branch $DEPENDENCY_BRANCH does not exist in $DEPENDENCY_MODULE. Please verify that you pushed your changes."
exit 1
fi
if test -z "$DEPENDENCY_IGNORE_VERSION"; then

Просмотреть файл

@ -1,5 +1,5 @@
ifdef ENABLE_XAMARIN
NEEDED_MACCORE_VERSION := 76ab6a58ff9061d35450f4bc75d075874a8489a8
NEEDED_MACCORE_VERSION := 347ba77a16159e911191587a49dd55c100117c84
NEEDED_MACCORE_BRANCH := master
MACCORE_DIRECTORY := maccore

Просмотреть файл

@ -179,7 +179,9 @@
new XDelegate ("MonoObject *", "IntPtr", "xamarin_get_nsobject_with_type",
"id", "IntPtr", "obj",
"void *", "IntPtr", "type",
"int32_t *", "out bool", "created"
"int32_t *", "out bool", "created",
"SEL", "IntPtr", "selector",
"MonoReflectionMethod *", "IntPtr", "method"
) {
WrappedManagedFunction = "GetNSObjectWithType",
OnlyDynamicUsage = false,
@ -271,6 +273,14 @@
WrappedManagedFunction = "ConvertNSStringToSmartEnum",
OnlyDynamicUsage = true,
},
new XDelegate ("int32_t", "int", "xamarin_create_runtime_exception",
"int32_t", "int", "code",
"const char *", "IntPtr", "message"
) {
WrappedManagedFunction = "CreateRuntimeException",
OnlyDynamicUsage = false,
},
};
delegates.CalculateLengths ();
#><#+

Просмотреть файл

@ -239,11 +239,12 @@
#region metadata/object-internals.h
new Export (true, "void", "mono_set_pending_exception",
"MonoException *", "exc"
new Export (true, "void", "mono_runtime_set_pending_exception",
"MonoException *", "exc",
"mono_bool", "overwrite"
)
{
AlternativeEntryPoint = "mono_raise_exception",
AlternativeExpression = "return mono_raise_exception (exc);",
},
#endregion
@ -674,7 +675,7 @@
{
public string ReturnType;
public string EntryPoint;
public string AlternativeEntryPoint;
public string AlternativeExpression;
public List<Arg> Arguments;
public bool Optional;

Просмотреть файл

@ -125,8 +125,8 @@ MONO_API <#= export.ReturnType #>
{
<# if (export.Optional) { #>
if (<#= export.EntryPoint #>_func == NULL)
<# if (!string.IsNullOrEmpty (export.AlternativeEntryPoint)) { #>
return <#= export.AlternativeEntryPoint #> (<#= export.ArgumentNames #>);
<# if (!string.IsNullOrEmpty (export.AlternativeExpression)) { #>
<#= export.AlternativeExpression #>
<# } else {#>
xamarin_assertion_message ("Could not load <#= export.EntryPoint #>\n");
<# } #>

Просмотреть файл

@ -257,17 +257,17 @@ xamarin_get_parameter_type (MonoMethod *managed_method, int index)
}
MonoObject *
xamarin_get_nsobject_with_type_for_ptr (id self, bool owns, MonoType* type, guint32 *exception_gchandle)
xamarin_get_nsobject_with_type_for_ptr (id self, bool owns, MonoType* type, SEL selector, MonoMethod *managed_method, guint32 *exception_gchandle)
{
// COOP: Reading managed data, must be in UNSAFE mode
MONO_ASSERT_GC_UNSAFE;
int32_t created;
return xamarin_get_nsobject_with_type_for_ptr_created (self, owns, type, &created, exception_gchandle);
return xamarin_get_nsobject_with_type_for_ptr_created (self, owns, type, &created, selector, managed_method, exception_gchandle);
}
MonoObject *
xamarin_get_nsobject_with_type_for_ptr_created (id self, bool owns, MonoType *type, int32_t *created, guint32 *exception_gchandle)
xamarin_get_nsobject_with_type_for_ptr_created (id self, bool owns, MonoType *type, int32_t *created, SEL selector, MonoMethod *managed_method, guint32 *exception_gchandle)
{
// COOP: Reading managed data, must be in UNSAFE mode
MONO_ASSERT_GC_UNSAFE;
@ -288,7 +288,7 @@ xamarin_get_nsobject_with_type_for_ptr_created (id self, bool owns, MonoType *ty
return mobj;
}
return xamarin_get_nsobject_with_type (self, mono_type_get_object (mono_domain_get (), type), created, exception_gchandle);
return xamarin_get_nsobject_with_type (self, mono_type_get_object (mono_domain_get (), type), created, selector, managed_method == NULL ? NULL : mono_method_get_object (mono_domain_get (), managed_method, NULL), exception_gchandle);
}
MonoObject *
@ -672,9 +672,10 @@ xamarin_check_for_gced_object (MonoObject *obj, SEL sel, id self, MonoMethod *me
char *type_name = xamarin_lookup_managed_type_name ([self class], exception_gchandle);
if (*exception_gchandle == 0) {
char *msg = xamarin_strdup_printf (m, self, object_getClassName (self), type_name, sel_getName (sel), method_full_name);
MonoException *mex = xamarin_create_exception (msg);
guint32 ex_handle = xamarin_create_runtime_exception (8027, msg, exception_gchandle);
xamarin_free (msg);
*exception_gchandle = mono_gchandle_new ((MonoObject *) mex, FALSE);
if (*exception_gchandle == 0)
*exception_gchandle = ex_handle;
}
mono_free (type_name);
mono_free (method_full_name);
@ -2118,6 +2119,16 @@ get_method_block_wrapper_creator (MonoMethod *method, int par, guint32 *exceptio
return res;
}
void
xamarin_release_block_on_main_thread (void *obj)
{
if ([NSThread isMainThread]) {
_Block_release (obj);
} else {
dispatch_async_f (dispatch_get_main_queue (), obj, (dispatch_function_t) _Block_release);
}
}
/*
* Creates a System.Delegate to wrap an Objective-C proxy when surfacing parameters from Objective-C to C#.
* @method: method where the parameter is found
@ -2167,7 +2178,7 @@ xamarin_get_delegate_for_block_parameter (MonoMethod *method, guint32 token_ref,
MONO_EXIT_GC_SAFE;
if (block_wrapper_queue == NULL)
block_wrapper_queue = mono_gc_reference_queue_new ((void(*)(void*))_Block_release);
block_wrapper_queue = mono_gc_reference_queue_new (xamarin_release_block_on_main_thread);
mono_gc_reference_queue_add (block_wrapper_queue, delegate, nativeBlock);
pthread_mutex_unlock (&wrapper_hash_lock);
@ -2277,7 +2288,7 @@ xamarin_process_nsexception_using_mode (NSException *ns_exception, bool throwMan
if (exc_handle != NULL) {
int handle = [exc_handle getHandle];
MonoObject *exc = mono_gchandle_get_target (handle);
mono_set_pending_exception ((MonoException *) exc);
mono_runtime_set_pending_exception ((MonoException *) exc, false);
} else {
int handle = xamarin_create_ns_exception (ns_exception, &exception_gchandle);
if (exception_gchandle != 0) {
@ -2288,7 +2299,7 @@ xamarin_process_nsexception_using_mode (NSException *ns_exception, bool throwMan
}
MONO_ENTER_GC_UNSAFE;
MonoObject *exc = mono_gchandle_get_target (handle);
mono_set_pending_exception ((MonoException *) exc);
mono_runtime_set_pending_exception ((MonoException *) exc, false);
mono_gchandle_free (handle);
MONO_EXIT_GC_UNSAFE;
}

Просмотреть файл

@ -118,7 +118,7 @@ xamarin_invoke_trampoline (enum TrampolineType type, id self, SEL sel, iterator_
if (isCategoryInstance) {
// we know this must be an id
p = mono_signature_get_params (msig, &iter);
arg_ptrs [0] = xamarin_get_nsobject_with_type_for_ptr (self, false, p, &exception_gchandle);
arg_ptrs [0] = xamarin_get_nsobject_with_type_for_ptr (self, false, p, sel, method, &exception_gchandle);
if (exception_gchandle != 0)
goto exception_handling;
mofs = 1;
@ -195,7 +195,7 @@ xamarin_invoke_trampoline (enum TrampolineType type, id self, SEL sel, iterator_
MonoObject *obj;
NSObject *targ = *(NSObject **) arg;
obj = xamarin_get_nsobject_with_type_for_ptr (targ, false, p, &exception_gchandle);
obj = xamarin_get_nsobject_with_type_for_ptr (targ, false, p, sel, method, &exception_gchandle);
if (exception_gchandle != 0)
goto exception_handling;
#if DEBUG
@ -324,7 +324,7 @@ xamarin_invoke_trampoline (enum TrampolineType type, id self, SEL sel, iterator_
} else {
MonoObject *obj;
id targ = [arr objectAtIndex: j];
obj = xamarin_get_nsobject_with_type_for_ptr (targ, false, e, &exception_gchandle);
obj = xamarin_get_nsobject_with_type_for_ptr (targ, false, e, sel, method, &exception_gchandle);
if (exception_gchandle != 0)
goto exception_handling;
#if DEBUG
@ -343,7 +343,7 @@ xamarin_invoke_trampoline (enum TrampolineType type, id self, SEL sel, iterator_
}
MonoObject *obj;
int32_t created = false;
obj = xamarin_get_nsobject_with_type_for_ptr_created (id_arg, false, p, &created, &exception_gchandle);
obj = xamarin_get_nsobject_with_type_for_ptr_created (id_arg, false, p, &created, sel, method, &exception_gchandle);
if (exception_gchandle != 0)
goto exception_handling;
@ -380,7 +380,7 @@ xamarin_invoke_trampoline (enum TrampolineType type, id self, SEL sel, iterator_
[id_arg autorelease];
}
MonoObject *obj;
obj = xamarin_get_nsobject_with_type_for_ptr (id_arg, false, p, &exception_gchandle);
obj = xamarin_get_nsobject_with_type_for_ptr (id_arg, false, p, sel, method, &exception_gchandle);
if (exception_gchandle != 0)
goto exception_handling;
#if DEBUG

Просмотреть файл

@ -1122,7 +1122,7 @@ xamarin_nsstring_to_smart_enum (id value, void *ptr, MonoClass *managedType, gui
managed_method = xamarin_get_managed_method_for_token (context /* token ref */, exception_gchandle);
if (*exception_gchandle != 0) return NULL;
arg_ptrs [0] = xamarin_get_nsobject_with_type_for_ptr (value, false, xamarin_get_parameter_type (managed_method, 0), exception_gchandle);
arg_ptrs [0] = xamarin_get_nsobject_with_type_for_ptr (value, false, xamarin_get_parameter_type (managed_method, 0), NULL, NULL, exception_gchandle);
if (*exception_gchandle != 0) return NULL;
obj = mono_runtime_invoke (managed_method, NULL, arg_ptrs, &exception);

Просмотреть файл

@ -173,8 +173,8 @@ bool xamarin_is_class_nsstring (MonoClass *cls);
bool xamarin_is_class_nullable (MonoClass *cls, MonoClass **element_type, guint32 *exception_gchandle);
MonoClass * xamarin_get_nullable_type (MonoClass *cls, guint32 *exception_gchandle);
MonoType * xamarin_get_parameter_type (MonoMethod *managed_method, int index);
MonoObject * xamarin_get_nsobject_with_type_for_ptr (id self, bool owns, MonoType* type, guint32 *exception_gchandle);
MonoObject * xamarin_get_nsobject_with_type_for_ptr_created (id self, bool owns, MonoType *type, int32_t *created, guint32 *exception_gchandle);
MonoObject * xamarin_get_nsobject_with_type_for_ptr (id self, bool owns, MonoType* type, SEL selector, MonoMethod *managed_method, guint32 *exception_gchandle);
MonoObject * xamarin_get_nsobject_with_type_for_ptr_created (id self, bool owns, MonoType *type, int32_t *created, SEL selector, MonoMethod *managed_method, guint32 *exception_gchandle);
int * xamarin_get_delegate_for_block_parameter (MonoMethod *method, guint32 token_ref, int par, void *nativeBlock, guint32 *exception_gchandle);
id xamarin_get_block_for_delegate (MonoMethod *method, MonoObject *delegate, const char *signature /* NULL allowed, but requires the dynamic registrar at runtime to compute */, guint32 *exception_gchandle);
id xamarin_get_nsobject_handle (MonoObject *obj);
@ -200,6 +200,7 @@ void xamarin_create_classes ();
const char * xamarin_skip_encoding_flags (const char *encoding);
void xamarin_add_registration_map (struct MTRegistrationMap *map);
uint32_t xamarin_find_protocol_wrapper_type (uint32_t token_ref);
void xamarin_release_block_on_main_thread (void *obj);
bool xamarin_has_managed_ref (id self);
bool xamarin_has_managed_ref_safe (id self);

Просмотреть файл

@ -202,8 +202,7 @@ namespace Compression
return ReadCore (new Span<byte> (array, offset, count));
}
// FIXME needs Span
internal override int Read (Span<byte> destination)
public override int Read (Span<byte> destination)
{
if (GetType () != typeof (CompressionStream)) {
// CompressStream is not sealed, and a derived type may have overridden Read(byte[], int, int) prior
@ -313,8 +312,7 @@ namespace Compression
return ReadAsyncMemory (new Memory<byte>(array, offset, count), cancellationToken).AsTask ();
}
// FIXME needs Span
internal override ValueTask<int> ReadAsync (Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
public override ValueTask<int> ReadAsync (Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
{
if (GetType () != typeof (CompressionStream)) {
// Ensure that existing streams derived from DeflateStream and that override ReadAsync(byte[],...)
@ -407,8 +405,7 @@ namespace Compression
WriteCore (new ReadOnlySpan<byte> (array, offset, count));
}
// FIXME needs Span
internal override void Write (ReadOnlySpan<byte> source)
public override void Write (ReadOnlySpan<byte> source)
{
if (GetType () != typeof (CompressionStream)) {
// DeflateStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior
@ -561,8 +558,7 @@ namespace Compression
return WriteAsyncMemory (new ReadOnlyMemory<byte> (array, offset, count), cancellationToken);
}
// FIXME needs Span
internal override Task WriteAsync (ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
public override Task WriteAsync (ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
{
if (GetType () != typeof (CompressionStream)) {
// Ensure that existing streams derived from DeflateStream and that override WriteAsync(byte[],...)

Просмотреть файл

@ -107,6 +107,11 @@ namespace ObjCRuntime {
{
IntPtr @class = IntPtr.Zero;
if (type.IsByRef || type.IsPointer || type.IsArray) {
is_custom_type = false;
return IntPtr.Zero;
}
// We cache results in a dictionary (type_to_class) - we put failures (when @class = IntPtr.Zero) in the dictionary as well.
// We do as little as possible with the lock held (only fetch/add to the dictionary, nothing else)

Просмотреть файл

@ -906,7 +906,7 @@ namespace Registrar {
if (res.IsInstanceCategory) {
mthis = IntPtr.Zero;
} else {
var nsobj = Runtime.GetNSObject (obj, Runtime.MissingCtorResolution.ThrowConstructor1NotFound, true);
var nsobj = Runtime.GetNSObject (obj, Runtime.MissingCtorResolution.ThrowConstructor1NotFound, true, selector, ObjectWrapper.Convert (res.Method));
mthis = ObjectWrapper.Convert (nsobj);
if (res.Method.ContainsGenericParameters) {
res.WriteUnmanagedDescription (desc, Runtime.FindClosedMethod (nsobj.GetType (), res.Method));

Просмотреть файл

@ -416,6 +416,12 @@ namespace ObjCRuntime {
return GCHandle.ToIntPtr (GCHandle.Alloc (ex)).ToInt32 ();
}
static int CreateRuntimeException (int code, IntPtr message)
{
var ex = ErrorHelper.CreateError (code, Marshal.PtrToStringAuto (message));
return GCHandle.ToIntPtr (GCHandle.Alloc (ex)).ToInt32 ();
}
static IntPtr UnwrapNSException (int exc_handle)
{
var obj = GCHandle.FromIntPtr (new IntPtr (exc_handle)).Target;
@ -698,11 +704,11 @@ namespace ObjCRuntime {
return ObjectWrapper.Convert (GetINativeObject (ptr, owns, iface, type));
}
static IntPtr GetNSObjectWithType (IntPtr ptr, IntPtr type_ptr, out bool created)
static IntPtr GetNSObjectWithType (IntPtr ptr, IntPtr type_ptr, out bool created, IntPtr selector, IntPtr method)
{
// It doesn't work to use System.Type in the signature, we get garbage.
var type = (System.Type) ObjectWrapper.Convert (type_ptr);
return ObjectWrapper.Convert (GetNSObject (ptr, type, MissingCtorResolution.ThrowConstructor1NotFound, true, out created));
return ObjectWrapper.Convert (GetNSObject (ptr, type, MissingCtorResolution.ThrowConstructor1NotFound, true, out created, selector, method));
}
static void Dispose (IntPtr mobj)
@ -1016,7 +1022,7 @@ namespace ObjCRuntime {
Ignore,
}
static void MissingCtor (IntPtr ptr, IntPtr klass, Type type, MissingCtorResolution resolution)
static void MissingCtor (IntPtr ptr, IntPtr klass, Type type, MissingCtorResolution resolution, IntPtr selector = default (IntPtr), IntPtr method = default (IntPtr))
{
string msg;
@ -1041,15 +1047,26 @@ namespace ObjCRuntime {
return;
}
throw new Exception (string.Format (msg, ptr.ToString ("x"), new Class (klass).Name, type.FullName));
if (selector != IntPtr.Zero || method != IntPtr.Zero)
msg += "\nAdditional information:\n";
if (selector != IntPtr.Zero)
msg += $"\tSelector: {Selector.GetName (selector)}\n";
if (method != IntPtr.Zero) {
var mi = ObjectWrapper.Convert (method) as MethodBase;
if (mi != null)
msg += $"\tMethod: {mi.FullName}\n";
}
throw ErrorHelper.CreateError (8027, string.Format (msg, ptr.ToString ("x"), new Class (klass).Name, type.FullName));
}
static NSObject ConstructNSObject (IntPtr ptr, IntPtr klass, MissingCtorResolution missingCtorResolution)
static NSObject ConstructNSObject (IntPtr ptr, IntPtr klass, MissingCtorResolution missingCtorResolution, IntPtr selector = default (IntPtr), IntPtr method = default (IntPtr))
{
Type type = Class.Lookup (klass);
if (type != null) {
return ConstructNSObject<NSObject> (ptr, type, missingCtorResolution);
return ConstructNSObject<NSObject> (ptr, type, missingCtorResolution, selector, method);
} else {
return new NSObject (ptr);
}
@ -1061,7 +1078,8 @@ namespace ObjCRuntime {
}
// The generic argument T is only used to cast the return value.
static T ConstructNSObject<T> (IntPtr ptr, Type type, MissingCtorResolution missingCtorResolution) where T: class, INativeObject
// The 'selector' and 'method' arguments are only used in error messages.
static T ConstructNSObject<T> (IntPtr ptr, Type type, MissingCtorResolution missingCtorResolution, IntPtr selector = default (IntPtr), IntPtr method = default (IntPtr)) where T: class, INativeObject
{
if (type == null)
throw new ArgumentNullException ("type");
@ -1069,7 +1087,7 @@ namespace ObjCRuntime {
var ctor = GetIntPtrConstructor (type);
if (ctor == null) {
MissingCtor (ptr, IntPtr.Zero, type, missingCtorResolution);
MissingCtor (ptr, IntPtr.Zero, type, missingCtorResolution, selector, method);
return null;
}
@ -1158,7 +1176,7 @@ namespace ObjCRuntime {
return GetNSObject (ptr, MissingCtorResolution.ThrowConstructor1NotFound);
}
internal static NSObject GetNSObject (IntPtr ptr, MissingCtorResolution missingCtorResolution, bool evenInFinalizerQueue = false) {
internal static NSObject GetNSObject (IntPtr ptr, MissingCtorResolution missingCtorResolution, bool evenInFinalizerQueue = false, IntPtr selector = default (IntPtr), IntPtr method = default (IntPtr)) {
if (ptr == IntPtr.Zero)
return null;
@ -1167,7 +1185,7 @@ namespace ObjCRuntime {
if (o != null)
return o;
return ConstructNSObject (ptr, Class.GetClassForObject (ptr), missingCtorResolution);
return ConstructNSObject (ptr, Class.GetClassForObject (ptr), missingCtorResolution, selector, method);
}
static public T GetNSObject<T> (IntPtr ptr) where T : NSObject
@ -1237,7 +1255,8 @@ namespace ObjCRuntime {
// NSObject subclasses (the test case in #13518 should work even with type checks).
//
static NSObject GetNSObject (IntPtr ptr, Type target_type, MissingCtorResolution missingCtorResolution, bool evenInFinalizerQueue, out bool created) {
// The 'selector' and 'method' arguments are only used in error messages.
static NSObject GetNSObject (IntPtr ptr, Type target_type, MissingCtorResolution missingCtorResolution, bool evenInFinalizerQueue, out bool created, IntPtr selector = default (IntPtr), IntPtr method = default (IntPtr)) {
created = false;
if (ptr == IntPtr.Zero)
@ -1269,7 +1288,7 @@ namespace ObjCRuntime {
}
created = true;
return ConstructNSObject<NSObject> (ptr, target_type, MissingCtorResolution.ThrowConstructor1NotFound);
return ConstructNSObject<NSObject> (ptr, target_type, MissingCtorResolution.ThrowConstructor1NotFound, selector, method);
}
static Type LookupINativeObjectImplementation (IntPtr ptr, Type target_type, Type implementation = null)
@ -1594,6 +1613,21 @@ namespace ObjCRuntime {
throw ErrorHelper.CreateError (8003, "Failed to find the closed generic method '{0}' on the type '{1}'.", open_method.Name, closed_type.FullName);
}
[EditorBrowsable (EditorBrowsableState.Never)]
#if MONOMAC
public static void ReleaseBlockOnMainThread (IntPtr block)
{
if (release_block_on_main_thread == null)
release_block_on_main_thread = LookupInternalFunction<intptr_func> ("xamarin_release_block_on_main_thread");
release_block_on_main_thread (block);
}
delegate void intptr_func (IntPtr block);
static intptr_func release_block_on_main_thread;
#else
[DllImport ("__Internal", EntryPoint = "xamarin_release_block_on_main_thread")]
public static extern void ReleaseBlockOnMainThread (IntPtr block);
#endif
}
internal class IntPtrEqualityComparer : IEqualityComparer<IntPtr>

Просмотреть файл

@ -3921,6 +3921,10 @@ namespace AppKit {
[Mac (10,10)]
[Static, Export ("quaternaryLabelColor")]
NSColor QuaternaryLabelColor { get; }
[Mac (10, 10)]
[Static, Export ("linkColor", ArgumentSemantic.Strong)]
NSColor LinkColor { get; }
[Mac (10,12)]
[Static]

Просмотреть файл

@ -10255,7 +10255,16 @@ namespace Foundation
interface NSDistributedNotificationCenter {
[Static]
[Export ("defaultCenter")]
#if XAMCORE_4_0
NSDistributedNotificationCenter DefaultCenter { get; }
#else
NSDistributedNotificationCenter GetDefaultCenter ();
[Static]
[Advice ("Use 'GetDefaultCenter ()' for a strongly typed version.")]
[Wrap ("GetDefaultCenter ()")]
NSObject DefaultCenter { get; }
#endif
[Export ("addObserver:selector:name:object:suspensionBehavior:")]
void AddObserver (NSObject observer, Selector selector, [NullAllowed] string notificationName, [NullAllowed] string notificationSenderc, NSNotificationSuspensionBehavior suspensionBehavior);

Просмотреть файл

@ -2514,9 +2514,6 @@ public partial class Generator : IMemberGatherer {
print ("");
print ("[DllImport (\"/usr/lib/libobjc.dylib\")]");
print ("static extern IntPtr _Block_copy (IntPtr ptr);");
print ("");
print ("[DllImport (\"/usr/lib/libobjc.dylib\")]");
print ("static extern void _Block_release (IntPtr ptr);");
while (trampolines.Count > 0){
var queue = trampolines.Values.ToArray ();
@ -2604,7 +2601,7 @@ public partial class Generator : IMemberGatherer {
print_generated_code ();
print ("~{0} ()", ti.NativeInvokerName);
print ("{"); indent++;
print ("_Block_release (blockPtr);", ns.CoreObjCRuntime);
print ("Runtime.ReleaseBlockOnMainThread (blockPtr);", ns.CoreObjCRuntime);
indent--; print ("}");
print ("");
print ("[Preserve (Conditional=true)]");

Просмотреть файл

@ -110,17 +110,17 @@ while ! test -z $1; do
done
# reporting functions
COLOR_RED=$(tput setaf 1 2>/dev/null || true)
COLOR_ORANGE=$(tput setaf 3 2>/dev/null || true)
COLOR_MAGENTA=$(tput setaf 5 2>/dev/null || true)
COLOR_CLEAR=$(tput sgr0 2>/dev/null || true)
function fail () {
tput setaf 1 2>/dev/null || true
echo " $1"
tput sgr0 2>/dev/null || true
echo " ${COLOR_RED}$1${COLOR_CLEAR}"
FAIL=1
}
function warn () {
tput setaf 3 2>/dev/null || true
echo " $1"
tput sgr0 2>/dev/null || true
echo " ${COLOR_ORANGE}$1${COLOR_CLEAR}"
}
function ok () {
@ -439,6 +439,7 @@ function check_mono () {
fail "You may edit Make.config and change MAX_MONO_VERSION to your actual version to continue the"
fail "build (unless you're on a release branch). Once the build completes successfully, please"
fail "commit the new MAX_MONO_VERSION value."
fail "Alternatively you can ${COLOR_MAGENTA}export IGNORE_MONO=1${COLOR_RED} to skip this check."
return
fi
fi
@ -551,7 +552,9 @@ function check_visual_studio () {
fail "You may edit Make.config and change MAX_VISUAL_STUDIO_VERSION to your actual version to continue the"
fail "build (unless you're on a release branch). Once the build completes successfully, please"
fail "commit the new MAX_VISUAL_STUDIO_VERSION value."
fail "Alternatively you can download an older version from $VS_URL."
fail "Alternatively you can download an older version from:"
fail " $VS_URL,"
fail "or you can ${COLOR_MAGENTA}export IGNORE_VISUAL_STUDIO=1${COLOR_RED} to skip this check."
fi
return
fi
@ -661,6 +664,7 @@ function check_objective_sharpie () {
else
if test -z $OPTIONAL_SHARPIE; then
fail "You must install Objective Sharpie, at least $MIN_SHARPIE_VERSION (no Objective Sharpie found). You can download it from $SHARPIE_URL"
fail "Alternatively you can ${COLOR_MAGENTA}export IGNORE_SHARPIE=1${COLOR_RED} to skip this check."
else
warn "You do not have Objective Sharpie installed (should be at least $MIN_SHARPIE_VERSION). You can download it from $SHARPIE_URL"
fi
@ -675,6 +679,7 @@ function check_objective_sharpie () {
else
if test -z $OPTIONAL_SHARPIE; then
fail "You must have at least Objective Sharpie $MIN_SHARPIE_VERSION, found $ACTUAL_SHARPIE_VERSION. You can download it from $SHARPIE_URL"
fail "Alternatively you can ${COLOR_MAGENTA}export IGNORE_SHARPIE=1${COLOR_RED} to skip this check."
else
warn "You do not have have at least Objective Sharpie $MIN_SHARPIE_VERSION (found $ACTUAL_SHARPIE_VERSION). You can download it from $SHARPIE_URL"
fi
@ -689,6 +694,7 @@ function check_objective_sharpie () {
else
if test -z $OPTIONAL_SHARPIE; then
fail "Your Objective Sharpie version is too new, max version is $MAX_SHARPIE_VERSION, found $ACTUAL_SHARPIE_VERSION. We recommend you download $SHARPIE_URL"
fail "Alternatively you can ${COLOR_MAGENTA}export IGNORE_SHARPIE=1${COLOR_RED} to skip this check."
else
warn "You do not have have at most Objective Sharpie $MAX_SHARPIE_VERSION (found $ACTUAL_SHARPIE_VERSION). We recommend you download $SHARPIE_URL"
fi

Просмотреть файл

@ -31,6 +31,7 @@ namespace XamarinTests.ObjCRuntime {
}
}
#if __UNIFIED__
[Test]
public void IntPtrCtor ()
{
@ -38,24 +39,22 @@ namespace XamarinTests.ObjCRuntime {
try {
ptr = Messaging.IntPtr_objc_msgSend (Class.GetHandle (typeof (IntPtrCtorTestClass)), Selector.GetHandle ("alloc"));
ptr = Messaging.IntPtr_objc_msgSend (ptr, Selector.GetHandle ("init"));
var ex = Assert.Throws<Exception> (() => Messaging.bool_objc_msgSend_IntPtr (ptr, Selector.GetHandle ("conformsToProtocol:"), IntPtr.Zero));
var ex = Assert.Throws<RuntimeException> (() => Messaging.bool_objc_msgSend_IntPtr (ptr, Selector.GetHandle ("conformsToProtocol:"), IntPtr.Zero));
var msg = string.Format ("Failed to marshal the Objective-C object 0x{0} (type: IntPtrCtorTestClass). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'XamarinTests.ObjCRuntime.RegistrarSharedTest+IntPtrCtorTestClass' does not have a constructor that takes one IntPtr argument).", ptr.ToString ("x"));
msg += "\nAdditional information:\n\tSelector: conformsToProtocol:\n\tMethod: ";
// The difference between the registrars is basically whether this string
// was constructed by native mono API or managed API.
if (CurrentRegistrar == Registrars.Static) {
msg += "\nAdditional information:\n\tSelector: conformsToProtocol:\n\tMethod: ";
#if !XAMCORE_2_0
#if __IOS__
msg += "MonoTouch.";
#else
msg += "MonoMac.";
#endif
#endif
msg += "Foundation.NSObject:InvokeConformsToProtocol (intptr)\n";
} else {
msg += "Foundation.NSObject.InvokeConformsToProtocol(IntPtr)\n";
}
Assert.AreEqual (msg, ex.Message, "#message");
} finally {
Messaging.void_objc_msgSend (ptr, Selector.GetHandle ("release"));
}
}
#endif
[Register ("IntPtrCtorTestClass")]
class IntPtrCtorTestClass : NSObject {

Просмотреть файл

@ -323,6 +323,16 @@ namespace Bindings.Test {
[Export ("callOptionalStaticCallback")]
void CallOptionalStaticCallback ();
[Static]
[Export ("callAssertMainThreadBlockRelease:")]
void CallAssertMainThreadBlockRelease (OuterBlock completionHandler);
[Export ("assertMainThreadBlockReleaseCallback:")]
void AssertMainThreadBlockReleaseCallback (InnerBlock completionHandler);
[Export ("callAssertMainThreadBlockReleaseCallback")]
void CallAssertMainThreadBlockReleaseCallback ();
[Export ("testFreedBlocks")]
void TestFreedBlocks ();
@ -331,6 +341,9 @@ namespace Bindings.Test {
int FreedBlockCount { get; }
}
delegate void InnerBlock (int magic_number);
delegate void OuterBlock ([BlockCallback] InnerBlock callback);
[BaseType (typeof (NSObject))]
interface EvilDeallocator
{

Просмотреть файл

@ -55,5 +55,24 @@ namespace Xamarin.Tests
};
}
}
[Test]
public void MainThreadDeallocationTest ()
{
ObjCBlockTester.CallAssertMainThreadBlockRelease ((callback) => {
callback (42);
});
using (var main_thread_tester = new MainThreadTest ()) {
main_thread_tester.CallAssertMainThreadBlockReleaseCallback ();
}
}
class MainThreadTest : ObjCBlockTester {
public override void AssertMainThreadBlockReleaseCallback (InnerBlock completionHandler)
{
completionHandler (42);
}
}
}
}

Просмотреть файл

@ -125,6 +125,9 @@ namespace LinkAll.Attributes {
[Preserve (AllMembers = true)]
public class AttributeTest {
// Good enough to fool linker to abort the tracking
static string mscorlib = "mscorlib";
[Test]
public void DebugAssemblyAttributes ()
{
@ -187,7 +190,7 @@ namespace LinkAll.Attributes {
{
var d = new Dictionary<string,int> () { { "key", 0 } };
Assert.NotNull (d); // just to be 100% sure it won't be linked away (with the attribute we'll be looking for)
var proxy = Type.GetType ("System.Collections.Generic.Mscorlib_DictionaryDebugView`2, mscorlib");
var proxy = Type.GetType ("System.Collections.Generic.IDictionaryDebugView`2, " + mscorlib);
#if DEBUG
Assert.NotNull (proxy, "proxy");
// having the type is nice, but it must not be empty to be useful
@ -226,8 +229,8 @@ namespace LinkAll.Attributes {
// we ensure that we can create the type / call the code
Assert.True (SecurityDeclarationDecoratedUserCode.Check (), "call");
// we ensure that both the permission and the flag are NOT part of the final/linked binary (link all removes security declarations)
Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAttribute, mscorlib"), "FileIOPermissionAttribute");
Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAccess, mscorlib"), "FileIOPermissionAccess");
Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAttribute, " + mscorlib), "FileIOPermissionAttribute");
Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAccess, " + mscorlib), "FileIOPermissionAccess");
}
}
}

Просмотреть файл

@ -192,10 +192,10 @@ namespace LinkAll {
{
#if !__WATCHOS__
// for (future) nunit[lite] platform detection - if this test fails then platform detection won't work
Assert.NotNull (Type.GetType (NamespacePrefix + "UIKit.UIApplicationDelegate, " + AssemblyName), "UIApplicationDelegate");
Assert.NotNull (Helper.GetType (NamespacePrefix + "UIKit.UIApplicationDelegate, " + AssemblyName), "UIApplicationDelegate");
#endif
// and you can trust the old trick with the linker
Assert.NotNull (Type.GetType ("Mono.Runtime"), "Mono.Runtime");
Assert.NotNull (Helper.GetType ("Mono.Runtime"), "Mono.Runtime");
}
[Test]
@ -220,16 +220,16 @@ namespace LinkAll {
// since we're linking the attributes will NOT be available - even if they are used
#if !XAMCORE_3_0
Assert.Null (Type.GetType (prefix + "ObjCRuntime.AvailabilityAttribute, " + suffix), "AvailabilityAttribute");
Assert.Null (Type.GetType (prefix + "ObjCRuntime.iOSAttribute, " + suffix), "AvailabilityAttribute");
Assert.Null (Type.GetType (prefix + "ObjCRuntime.AvailabilityAttribute, " + suffix), "AvailabilityAttribute");
Assert.Null (Type.GetType (prefix + "ObjCRuntime.SinceAttribute, " + suffix), "SinceAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.AvailabilityAttribute, " + suffix), "AvailabilityAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.iOSAttribute, " + suffix), "AvailabilityAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.AvailabilityAttribute, " + suffix), "AvailabilityAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.SinceAttribute, " + suffix), "SinceAttribute");
#endif
Assert.Null (Type.GetType (prefix + "ObjCRuntime.IntroducedAttribute, " + suffix), "IntroducedAttribute");
Assert.Null (Type.GetType (prefix + "ObjCRuntime.DeprecatedAttribute, " + suffix), "DeprecatedAttribute");
Assert.Null (Type.GetType (prefix + "ObjCRuntime.ObsoletedAttribute, " + suffix), "ObsoletedAttribute");
Assert.Null (Type.GetType (prefix + "ObjCRuntime.UnavailableAttribute, " + suffix), "UnavailableAttribute");
Assert.Null (Type.GetType (prefix + "ObjCRuntime.ThreadSafeAttribute, " + suffix), "ThreadSafeAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.IntroducedAttribute, " + suffix), "IntroducedAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.DeprecatedAttribute, " + suffix), "DeprecatedAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.ObsoletedAttribute, " + suffix), "ObsoletedAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.UnavailableAttribute, " + suffix), "UnavailableAttribute");
Assert.Null (Helper.GetType (prefix + "ObjCRuntime.ThreadSafeAttribute, " + suffix), "ThreadSafeAttribute");
}
[Test]
@ -419,14 +419,14 @@ namespace LinkAll {
// Compiler optimization (roslyn release) can remove the variable, which removes OpenTK-1.dll from the app and fail the test
Assert.That (state, Is.EqualTo (OpenTK.WindowState.Normal), "normal");
var gl = Type.GetType ("OpenTK.Graphics.ES11.GL, OpenTK-1.0", false);
var gl = Helper.GetType ("OpenTK.Graphics.ES11.GL, OpenTK-1.0", false);
Assert.NotNull (gl, "ES11/GL");
var core = Type.GetType ("OpenTK.Graphics.ES11.GL/Core, OpenTK-1.0", false);
var core = Helper.GetType ("OpenTK.Graphics.ES11.GL/Core, OpenTK-1.0", false);
Assert.NotNull (core, "ES11/Core");
gl = Type.GetType ("OpenTK.Graphics.ES20.GL, OpenTK-1.0", false);
gl = Helper.GetType ("OpenTK.Graphics.ES20.GL, OpenTK-1.0", false);
Assert.NotNull (gl, "ES20/GL");
core = Type.GetType ("OpenTK.Graphics.ES20.GL/Core, OpenTK-1.0", false);
core = Helper.GetType ("OpenTK.Graphics.ES20.GL/Core, OpenTK-1.0", false);
Assert.NotNull (core, "ES20/Core");
}
#endif // !__WATCHOS__
@ -435,7 +435,7 @@ namespace LinkAll {
public void NestedNSObject ()
{
// Parent type is not used - but it's not linked out
var p = Type.GetType ("LinkAll.Parent");
var p = Helper.GetType ("LinkAll.Parent");
Assert.NotNull (p, "Parent");
// because a nested type is a subclass of NSObject (and not part of monotouch.dll)
var n = p.GetNestedType ("Derived");
@ -539,7 +539,7 @@ namespace LinkAll {
{
// make test work for classic (monotouch) and unified (iOS, tvOS and watchOS)
var fqn = typeof (NSObject).AssemblyQualifiedName.Replace ("Foundation.NSObject", "Security.Tls.AppleTlsProvider");
Assert.Null (Type.GetType (fqn), "Should NOT be included (no SslStream or Socket support)");
Assert.Null (Helper.GetType (fqn), "Should NOT be included (no SslStream or Socket support)");
}
[Test]
@ -548,7 +548,7 @@ namespace LinkAll {
{
// this test works only because "Link all" does not use WebKit
var fqn = typeof (NSObject).AssemblyQualifiedName.Replace ("Foundation.NSObject", "Foundation.NSProxy");
Assert.Null (Type.GetType (fqn), fqn);
Assert.Null (Helper.GetType (fqn), fqn);
}
static Type type_Task = typeof (Task);

Просмотреть файл

@ -16,6 +16,22 @@ using MonoTouch.Foundation;
#endif
using NUnit.Framework;
namespace LinkAll
{
static class Helper
{
public static Type GetType (string name)
{
return Type.GetType (name);
}
public static Type GetType (string typeName, bool throwOnError)
{
return Type.GetType (typeName, throwOnError);
}
}
}
namespace LinkAll.Serialization {
[Serializable]
@ -75,7 +91,7 @@ namespace LinkAll.Serialization {
public void UnusedType ()
{
// the serialization attributes only keeps the method(s) if the type was used
var t = Type.GetType ("LinkAll.Serialization.Unused");
var t = Helper.GetType ("LinkAll.Serialization.Unused");
// since it's not used in the app then it's removed by the linker
Assert.Null (t, "type");
}
@ -84,7 +100,7 @@ namespace LinkAll.Serialization {
public void UsedType ()
{
// the serialization attributes only keeps the method(s) if the type was used
var t = Type.GetType ("LinkAll.Serialization.Used");
var t = Helper.GetType ("LinkAll.Serialization.Used");
// since it's used here...
Assert.NotNull (new Used (), "reference");
// it's not removed by the linker

Просмотреть файл

@ -436,14 +436,14 @@ namespace LinkSdk {
#else
const string OpenTKAssembly = "OpenTK";
#endif
var gl = Type.GetType ("OpenTK.Graphics.ES11.GL, " + OpenTKAssembly, false);
var gl = GetTypeHelper ("OpenTK.Graphics.ES11.GL, " + OpenTKAssembly, false);
Assert.NotNull (gl, "ES11/GL");
var core = Type.GetType ("OpenTK.Graphics.ES11.GL/Core, " + OpenTKAssembly, false);
var core = GetTypeHelper ("OpenTK.Graphics.ES11.GL/Core, " + OpenTKAssembly, false);
Assert.NotNull (core, "ES11/Core");
gl = Type.GetType ("OpenTK.Graphics.ES20.GL, " + OpenTKAssembly, false);
gl = GetTypeHelper ("OpenTK.Graphics.ES20.GL, " + OpenTKAssembly, false);
Assert.NotNull (gl, "ES20/GL");
core = Type.GetType ("OpenTK.Graphics.ES20.GL/Core, " + OpenTKAssembly, false);
core = GetTypeHelper ("OpenTK.Graphics.ES20.GL/Core, " + OpenTKAssembly, false);
Assert.NotNull (core, "ES20/Core");
}
#endif // !__WATCHOS__
@ -773,7 +773,7 @@ namespace LinkSdk {
public void Pointer_5200 ()
{
// ensure the linker did not remove the type, which is used by the runtime
Assert.NotNull (Type.GetType ("System.Reflection.Pointer, mscorlib"));
Assert.NotNull (GetTypeHelper ("System.Reflection.Pointer, mscorlib"));
}
[Test]
@ -1065,8 +1065,8 @@ namespace LinkSdk {
// we ensure that we can create the type / call the code
Assert.True (SecurityDeclarationDecoratedUserCode.Check (), "call");
// we ensure that both the permission and the flag are NOT part of the final/linked binary (link removes security declarations)
Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAttribute, mscorlib"), "FileIOPermissionAttribute");
Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAccess, mscorlib"), "FileIOPermissionAccess");
Assert.Null (GetTypeHelper ("System.Security.Permissions.FileIOPermissionAttribute, mscorlib"), "FileIOPermissionAttribute");
Assert.Null (GetTypeHelper ("System.Security.Permissions.FileIOPermissionAccess, mscorlib"), "FileIOPermissionAccess");
}
#if !__WATCHOS__
@ -1094,7 +1094,7 @@ namespace LinkSdk {
[Test]
public void MonoRuntime34671 ()
{
Assert.NotNull (Type.GetType ("Mono.Runtime"), "Mono.Runtime");
Assert.NotNull (GetTypeHelper ("Mono.Runtime"), "Mono.Runtime");
}
[Test]
@ -1119,7 +1119,7 @@ namespace LinkSdk {
{
// make test work for classic (monotouch) and unified (iOS, tvOS and watchOS)
var fqn = typeof (NSObject).AssemblyQualifiedName.Replace ("Foundation.NSObject", "Security.Tls.OldTlsProvider");
Assert.Null (Type.GetType (fqn), "Should not be included");
Assert.Null (GetTypeHelper (fqn), "Should not be included");
}
[Test]
@ -1127,7 +1127,7 @@ namespace LinkSdk {
{
// make test work for classic (monotouch) and unified (iOS, tvOS and watchOS)
var fqn = typeof (NSObject).AssemblyQualifiedName.Replace ("Foundation.NSObject", "Security.Tls.AppleTlsProvider");
Assert.Null (Type.GetType (fqn), "Should be included");
Assert.Null (GetTypeHelper (fqn), "Should be included");
}
[Test]
@ -1138,7 +1138,18 @@ namespace LinkSdk {
var t = typeof (WKWebView);
Assert.NotNull (t, "avoid compiler optimization of unused variable");
var fqn = typeof (NSObject).AssemblyQualifiedName.Replace ("Foundation.NSObject", "Foundation.NSProxy");
Assert.NotNull (Type.GetType (fqn), fqn);
Assert.NotNull (GetTypeHelper (fqn), fqn);
}
// Fools linker not to keep the type by using it in test check
static Type GetTypeHelper (string name)
{
return Type.GetType (name);
}
static Type GetTypeHelper (string name, bool throwOnError)
{
return Type.GetType (name, throwOnError);
}
}
}

Просмотреть файл

@ -31,9 +31,12 @@ namespace Xamarin.Mac.Linker.Test {
}
}
static string linker_removed_type = "MonoMac.CoreImage.CIColor, XamMac";
public static void EnsureLinker (bool enabled)
{
if ((Type.GetType ("MonoMac.CoreImage.CIColor, XamMac") != null) == enabled) {
if ((Type.GetType (linker_removed_type) != null) == enabled) {
Log.WriteLine ("[FAIL]\tThe linker was {0}enabled on this build", enabled ? "not " : String.Empty);
}
}

Просмотреть файл

@ -18,6 +18,7 @@ namespace Xamarin.Mac.Linker.Test {
}
class TypeDescriptorTest {
static string typeToCheck = "Xamarin.Mac.Linker.Test.CustomConverter";
static void Check (string typeName)
{
@ -57,7 +58,7 @@ namespace Xamarin.Mac.Linker.Test {
Check ("System.ComponentModel.CollectionConverter");
Check ("System.ComponentModel.EnumConverter");
var t = Type.GetType ("Xamarin.Mac.Linker.Test.CustomConverter", false);
var t = Type.GetType (typeToCheck, false);
Test.Log.WriteLine ("{0}\tXamarin.Mac.Linker.Test.CustomConverter", t == null ? "[PASS]" : "[FAIL]");
Test.Terminate ();

Просмотреть файл

@ -85,6 +85,9 @@ namespace MonoTouchFixtures.ObjCRuntime {
Assert.AreEqual ("Can't register the class System.String when the dynamic registrar has been linked away.", e.Message, "exc message");
}
}
Assert.AreEqual (IntPtr.Zero, Class.GetHandle (typeof (NSObject).MakeByRefType ()), "NSObject&");
Assert.AreEqual (IntPtr.Zero, Class.GetHandle (typeof (NSObject).MakeArrayType ()), "NSObject[]");
Assert.AreEqual (IntPtr.Zero, Class.GetHandle (typeof (NSObject).MakePointerType ()), "NSObject*");
}
[Test]

Просмотреть файл

@ -2087,7 +2087,7 @@ namespace MonoTouchFixtures.ObjCRuntime {
ptr = Messaging.IntPtr_objc_msgSend (Class.GetHandle (typeof (D2)), Selector.GetHandle ("alloc"));
ptr = Messaging.IntPtr_objc_msgSend (ptr, Selector.GetHandle ("init"));
// Failed to marshal the Objective-C object 0x7adf5920 (type: AppDelegate_D2). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'AppDelegate+D2' does not have a constructor that takes one IntPtr argument).
Assert.Throws<Exception> (() => Runtime.GetNSObject<D2> (ptr), "c");
Assert.Throws<RuntimeException> (() => Runtime.GetNSObject<D2> (ptr), "c");
} finally {
Messaging.void_objc_msgSend (ptr, Selector.GetHandle ("release"));
}
@ -2532,6 +2532,28 @@ namespace MonoTouchFixtures.ObjCRuntime {
using (var obj = new NullOutParameters ())
obj.Invoke_V_null_out ();
}
[Test]
public unsafe void ByrefParameter ()
{
using (var obj = new ByrefParameterTest ()) {
using (var param = new NSObject ()) {
// We want an instance of an NSObject subclass that doesn't have a managed wrapper, so we create a native NSString handle.
IntPtr handle = NSString.CreateNative ("ByrefParameter");
Messaging.void_objc_msgSend_IntPtr (obj.Handle, Selector.GetHandle ("doSomething:"), new IntPtr (&handle));
NSString.ReleaseNative (handle);
}
}
}
class ByrefParameterTest : NSObject {
[Export ("doSomething:")]
public void DoSomething (ref NSString str)
{
Assert.IsNotNull (str, "NonNull NSString&");
Assert.AreEqual ("ByrefParameter", str.ToString ());
}
}
}
#if !__WATCHOS__

Просмотреть файл

@ -591,5 +591,55 @@ namespace MonoTouchFixtures.ObjCRuntime {
Assert.AreEqual (0, brokenCount, "broken count");
}
[Test]
public void MX8027 ()
{
var handle = Messaging.IntPtr_objc_msgSend (Messaging.IntPtr_objc_msgSend (Class.GetHandle (typeof (Dummy)), Selector.GetHandle ("alloc")), Selector.GetHandle ("init"));
try {
try {
Messaging.void_objc_msgSend_IntPtr (Class.GetHandle (typeof (Dummy)), Selector.GetHandle ("doSomethingElse:"), handle);
Assert.Fail ("Expected an MX8027 exception (A)");
} catch (RuntimeException mex) {
Assert.AreEqual (8027, mex.Code, "Exception code (A)");
Assert.That (mex.Message, Is.StringContaining ("Failed to marshal the Objective-C object"), "Failed to marshal (A)");
Assert.That (mex.Message, Is.StringContaining ("Additional information:"), "Additional information: (A)");
Assert.That (mex.Message, Is.StringContaining ("Selector: doSomethingElse:"), "Selector (A)");
Assert.That (mex.Message, Is.StringContaining ("DoSomethingElse"), "DoSomethingElse (A)");
}
try {
Messaging.void_objc_msgSend_IntPtr (handle, Selector.GetHandle ("doSomething:"), handle);
Assert.Fail ("Expected an MX8027 exception (B)");
} catch (RuntimeException mex) {
Assert.AreEqual (8027, mex.Code, "Exception code (B)");
Assert.That (mex.Message, Is.StringContaining ("Failed to marshal the Objective-C object"), "Failed to marshal (B)");
Assert.That (mex.Message, Is.StringContaining ("Additional information:"), "Additional information: (B)");
Assert.That (mex.Message, Is.StringContaining ("Selector: doSomething:"), "Selector (B)");
Assert.That (mex.Message, Is.StringContaining ("DoSomething"), "DoSomething (B)");
}
} finally {
Messaging.void_objc_msgSend (handle, Selector.GetHandle ("release"));
}
}
// does not have an IntPtr constructor
class Dummy : NSObject {
[Export ("initWithFoo:")]
public Dummy (int foo)
{
// Prevent the default ctor from being exported.
}
[Export ("doSomething:")]
public void DoSomething (Dummy dummy)
{
}
[Export ("doSomethingElse:")]
public static void DoSomethingElse (Dummy dummy)
{
}
}
}
}

Просмотреть файл

@ -167,6 +167,11 @@ typedef unsigned int (^RegistrarTestBlock) (unsigned int magic);
+(void) callRequiredStaticCallback;
-(void) callOptionalCallback;
+(void) callOptionalStaticCallback;
typedef void (^innerBlock) (int magic_number);
typedef void (^outerBlock) (innerBlock callback);
+(void) callAssertMainThreadBlockRelease: (outerBlock) completionHandler;
-(void) callAssertMainThreadBlockReleaseCallback;
-(void) assertMainThreadBlockReleaseCallback: (innerBlock) completionHandler;
-(void) testFreedBlocks;
+(int) freedBlockCount;
@ -183,6 +188,12 @@ typedef unsigned int (^RegistrarTestBlock) (unsigned int magic);
-(void) dealloc;
@end
// This object asserts that its dealloc function is called on the main thread
@interface MainThreadDeallocator : NSObject {
}
-(void) dealloc;
@end
#ifdef __cplusplus
} /* extern "C" */
#endif

Просмотреть файл

@ -599,6 +599,45 @@ static Class _TestClass = NULL;
assert (called);
}
+(void) callAssertMainThreadBlockRelease: (outerBlock) completionHandler
{
MainThreadDeallocator *obj = [[MainThreadDeallocator alloc] init];
__block bool success = false;
dispatch_sync (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul), ^{
completionHandler (^(int magic_number)
{
assert (magic_number == 42);
assert ([NSThread isMainThread]); // This may crash way after the failed test has finished executing.
success = obj != NULL; // this captures the 'obj', and it's only freed when the block is freed.
});
});
assert (success);
[obj release];
}
-(void) callAssertMainThreadBlockReleaseCallback
{
MainThreadDeallocator *obj = [[MainThreadDeallocator alloc] init];
__block bool success = false;
dispatch_sync (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul), ^{
[self assertMainThreadBlockReleaseCallback: ^(int magic_number)
{
assert (magic_number == 42);
assert ([NSThread isMainThread]); // This may crash way after the failed test has finished executing.
success = obj != NULL; // this captures the 'obj', and it's only freed when the block is freed.
}];
});
assert (success);
[obj release];
}
-(void) assertMainThreadBlockReleaseCallback: (innerBlock) completionHandler
{
assert (!"THIS FUNCTION SHOULD BE OVERRIDDEN");
}
-(void) testFreedBlocks
{
FreedNotifier* obj = [[FreedNotifier alloc] init];
@ -634,4 +673,13 @@ static Class _TestClass = NULL;
}
@end
@implementation MainThreadDeallocator : NSObject {
}
-(void) dealloc
{
assert ([NSThread isMainThread]);
[super dealloc];
}
@end
#include "libtest.decompile.m"

Просмотреть файл

@ -6,6 +6,7 @@
#define ObjCBlockTester object_ObjCBlockTester
#define FreedNotifier object_FreedNotifier
#define EvilDeallocator object_EvilDeallocator
#define MainThreadDeallocator object_MainThreadDeallocator
#define FakeType2 object_FakeType2
#define UltimateMachine object_UltimateMachine
#define FrameworkTest object_FrameworkTest
@ -73,6 +74,7 @@
#define ObjCBlockTester ar_ObjCBlockTester
#define FreedNotifier ar_FreedNotifier
#define EvilDeallocator ar_EvilDeallocator
#define MainThreadDeallocator ar_MainThreadDeallocator
#define FakeType2 ar_FakeType2
#define UltimateMachine ar_UltimateMachine
#define FrameworkTest ar_FrameworkTest

Просмотреть файл

@ -1,5 +1,4 @@
!unknown-pinvoke! _Block_copy bound
!unknown-pinvoke! _Block_release bound
!unknown-pinvoke! class_addIvar bound
!unknown-pinvoke! class_addMethod bound
!unknown-pinvoke! class_addProperty bound

Просмотреть файл

@ -12,10 +12,9 @@ endif
APIDIFF_DIR=.
MONO_API_HTML_DIR = $(MONO_PATH)/mcs/tools/mono-api-html
MONO_API_INFO_DIR = $(MONO_PATH)/mcs/tools/corcompare
MONO_API_INFO = $(MONO_API_INFO_DIR)/bin/Debug/mono-api-info.exe
MONO_API_HTML = $(TOP)/external/macios-binaries/mono-api-html.exe
MONO_API_INFO = $(MONO_PATH)/mcs/class/lib/build/mono-api-info.exe
MONO_API_HTML = $(MONO_PATH)/mcs/class/lib/build/mono-api-html.exe
MONO_BUILD = MONO_PATH=$(MONO_PATH)/mcs/class/lib/build $(TOP)/builds/tools64/mono/mini/mono
# I18N are excluded - but otherwise if should be like ../../builds/Makefile + what XI adds
# in the order to the api-diff.html merged file
@ -50,21 +49,21 @@ MAC_ARCH_ASSEMBLIES = native-32/Xamarin.Mac native-64/Xamarin.Mac
# create api info. Directory hierarchy is based on installed hierarchy
# (XM goes into temp/xm, and XI goes into temp/xi)
$(APIDIFF_DIR)/temp/xi/%.xml: $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/%.dll $(MONO_API_INFO)
$(APIDIFF_DIR)/temp/xi/%.xml: $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/%.dll
$(Q) mkdir -p $(dir $@)
$(QF_GEN) mono --debug $(MONO_API_INFO) $< -o $@
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_INFO) $< -o $@
$(APIDIFF_DIR)/temp/xm/%.xml: $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/%.dll $(MONO_API_INFO)
$(APIDIFF_DIR)/temp/xm/%.xml: $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/%.dll
$(Q) mkdir -p $(dir $@)
$(QF_GEN) mono --debug $(MONO_API_INFO) $< -o $@
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_INFO) -d $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 $< -o $@
$(APIDIFF_DIR)/temp/native-%/Xamarin.Mac.xml: $(TOP)/src/build/mac/mobile-%/Xamarin.Mac.dll $(MONO_API_INFO)
$(APIDIFF_DIR)/temp/native-%/Xamarin.Mac.xml: $(TOP)/src/build/mac/mobile-%/Xamarin.Mac.dll
$(Q) mkdir -p $(dir $@)
$(QF_GEN) mono --debug $(MONO_API_INFO) $< -o $@
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_INFO) -d $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac $< -o $@
$(APIDIFF_DIR)/temp/native-%/Xamarin.iOS.xml: $(TOP)/src/build/ios/native-%/Xamarin.iOS.dll $(MONO_API_INFO)
$(APIDIFF_DIR)/temp/native-%/Xamarin.iOS.xml: $(TOP)/src/build/ios/native-%/Xamarin.iOS.dll
$(Q) mkdir -p $(dir $@)
$(QF_GEN) mono --debug $(MONO_API_INFO) $< -o $@
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_INFO) $< -o $@
# create diff from api info and reference info
# note that we create an empty file (the 'touch' command)
@ -72,24 +71,16 @@ $(APIDIFF_DIR)/temp/native-%/Xamarin.iOS.xml: $(TOP)/src/build/ios/native-%/Xama
# to run mono-api-html every time even if none of the
# dependencies changed)
$(APIDIFF_DIR)/diff/%.html: $(APIDIFF_DIR)/temp/%.xml $(APIDIFF_DIR)/references/%.xml $(MONO_API_HTML)
$(APIDIFF_DIR)/diff/%.html: $(APIDIFF_DIR)/temp/%.xml $(APIDIFF_DIR)/references/%.xml
$(Q) mkdir -p $(dir $@)
$(QF_GEN) mono --debug $(MONO_API_HTML) $(NEW_REGEX) $(ADD_REGEX) $(APIDIFF_DIR)/references/$*.xml $(APIDIFF_DIR)/temp/$*.xml -i 'INSObjectProtocol' $@
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_HTML) $(NEW_REGEX) $(ADD_REGEX) $(APIDIFF_DIR)/references/$*.xml $(APIDIFF_DIR)/temp/$*.xml -i 'INSObjectProtocol' $@
$(Q) touch $@
# this is a hack to show the difference between iOS and tvOS
$(APIDIFF_DIR)/diff/ios-to-tvos.html: $(APIDIFF_DIR)/temp/xi/Xamarin.iOS/Xamarin.iOS.xml $(APIDIFF_DIR)/temp/xi/Xamarin.TVOS/Xamarin.TVOS.xml
$(Q) mkdir -p $(dir $@)
$(Q) sed -e 's_<assembly name="Xamarin.TVOS" version="0.0.0.0">_<assembly name="Xamarin.iOS" version="0.0.0.0">_' $(APIDIFF_DIR)/temp/xi/Xamarin.TVOS/Xamarin.TVOS.xml > $(APIDIFF_DIR)/temp/Xamarin.TVOS-as-iOS.xml
$(QF_GEN) mono --debug $(MONO_API_HTML) $< $(APIDIFF_DIR)/temp/Xamarin.TVOS-as-iOS.xml $@
# our api-info and api-html binaries
$(MONO_API_HTML): $(wildcard $(MONO_API_HTML_DIR)/*.*)
$(Q_GEN) cd $(MONO_API_HTML_DIR) && $(SYSTEM_MSBUILD) mono-api-html.csproj $(MSBUILD_VERBOSITY)
$(MONO_API_INFO): $(wildcard $(MONO_API_INFO_DIR)/*.*)
$(Q_GEN) cd $(MONO_API_INFO_DIR) && $(SYSTEM_MSBUILD) mono-api-info.csproj $(MSBUILD_VERBOSITY)
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_HTML) $< $(APIDIFF_DIR)/temp/Xamarin.TVOS-as-iOS.xml $@
# create diff files for all the assemblies per platform
@ -252,7 +243,7 @@ macos-markdown: ; @true
endif
$(APIDIFF_DIR)/diff/%.md: $(APIDIFF_DIR)/temp/%.xml $(APIDIFF_DIR)/references/%.xml $(MONO_API_HTML)
$(QF_GEN) mono --debug $(MONO_API_HTML) $(NEW_REGEX) $(ADD_REGEX) $(APIDIFF_DIR)/references/$*.xml $(APIDIFF_DIR)/temp/$*.xml -i 'INSObjectProtocol' --md $@
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_HTML) $(NEW_REGEX) $(ADD_REGEX) $(APIDIFF_DIR)/references/$*.xml $(APIDIFF_DIR)/temp/$*.xml -i 'INSObjectProtocol' --md $@
wrench-api-diff:
@echo "@MonkeyWrench: AddDirectory: $(CURDIR)/diff/xi/Xamarin.iOS"

Просмотреть файл

@ -3596,7 +3596,7 @@ namespace Registrar {
setup_call_stack.AppendLine ("if (nsobj{0}) {{", i);
body_setup.AppendLine ("MonoType *paramtype{0} = NULL;", i);
setup_call_stack.AppendLine ("paramtype{0} = xamarin_get_parameter_type (managed_method, {0});", i);
setup_call_stack.AppendLine ("mobj{0} = xamarin_get_nsobject_with_type_for_ptr (nsobj{0}, false, paramtype{0}, &exception_gchandle);", i);
setup_call_stack.AppendLine ("mobj{0} = xamarin_get_nsobject_with_type_for_ptr (nsobj{0}, false, paramtype{0}, _cmd, managed_method, &exception_gchandle);", i);
setup_call_stack.AppendLine ("if (exception_gchandle != 0) goto exception_handling;");
if (App.EnableDebug) {
setup_call_stack.AppendLine ("xamarin_verify_parameter (mobj{0}, _cmd, self, nsobj{0}, {0}, mono_class_from_mono_type (paramtype{0}), managed_method);", i);
@ -3623,7 +3623,7 @@ namespace Registrar {
setup_call_stack.AppendLine ("if (nsobj{0}) {{", i);
body_setup.AppendLine ("MonoType *paramtype{0} = NULL;", i);
setup_call_stack.AppendLine ("paramtype{0} = xamarin_get_parameter_type (managed_method, {0});", i);
setup_call_stack.AppendLine ("mobj{0} = xamarin_get_nsobject_with_type_for_ptr_created (nsobj{0}, false, paramtype{0}, &created{0}, &exception_gchandle);", i);
setup_call_stack.AppendLine ("mobj{0} = xamarin_get_nsobject_with_type_for_ptr_created (nsobj{0}, false, paramtype{0}, &created{0}, _cmd, managed_method, &exception_gchandle);", i);
setup_call_stack.AppendLine ("if (exception_gchandle != 0) goto exception_handling;");
if (App.EnableDebug) {
setup_call_stack.AppendLine ("xamarin_verify_parameter (mobj{0}, _cmd, self, nsobj{0}, {0}, mono_class_from_mono_type (paramtype{0}), managed_method);", i);

Просмотреть файл

@ -23,6 +23,7 @@ linker_sources = \
$(LINKER_DIR)/Linker/Pipeline.cs \
$(LINKER_DIR)/Linker/AssemblyResolver.cs \
$(LINKER_DIR)/Linker/TypePreserve.cs \
$(LINKER_DIR)/Linker/TypeNameParser.cs \
$(LINKER_DIR)/Linker/Annotations.cs \
$(LINKER_DIR)/Linker/LinkContext.cs \
$(LINKER_DIR)/Linker/ILogger.cs \
@ -38,6 +39,7 @@ linker_sources = \
$(LINKER_DIR)/Linker/MarkingHelpers.cs \
$(LINKER_DIR)/Linker/Tracer.cs \
$(LINKER_DIR)/Linker/TypeReferenceExtensions.cs \
$(LINKER_DIR)/Linker/AssemblyUtilities.cs \
$(LINKER_DIR)/Linker.Steps/BaseStep.cs \
$(LINKER_DIR)/Linker.Steps/LoadReferencesStep.cs \
$(LINKER_DIR)/Linker.Steps/LoadI18nAssemblies.cs \
@ -147,8 +149,10 @@ LOCAL_MMP = \
Mono.Cecil.dll \
Mono.Cecil.Mdb.dll \
mmp.exe: Makefile $(MONO_CECIL_DLL) $(MONO_CECIL_MDB_DLL) $(mmp_sources) config config_mobile Info.plist.tmpl Info-framework.plist.tmpl $(tuner_sources) $(linker_resources)
$(Q_CSC) $(SYSTEM_CSC) -unsafe -out:mmp.exe $(DEFINES) -r:$(MONO_CECIL_DLL) -r:$(MONO_CECIL_MDB_DLL) -r:Mono.Security.dll -resource:config -resource:config_mobile -resource:machine.4_5.config -resource:Info.plist.tmpl -resource:Info-framework.plist.tmpl $(tuner_sources) $(mmp_sources) -debug:portable -nologo -deterministic
mmp.exe: Makefile $(MONO_CECIL_DLL) $(MONO_CECIL_MDB_DLL) $(mmp_sources) config config_mobile Info.plist.tmpl Info-framework.plist.tmpl $(tuner_sources)
$(Q_CSC) $(SYSTEM_CSC) -unsafe -out:mmp.exe $(DEFINES) -r:$(MONO_CECIL_DLL) -r:$(MONO_CECIL_MDB_DLL) \
-noconfig -nostdlib -r:$(MONO_PATH)/external/binary-reference-assemblies/mono/Mono.Security.dll -r:$(MONO_PATH)/external/binary-reference-assemblies/v4.6.1/mscorlib.dll -r:$(MONO_PATH)/external/binary-reference-assemblies/v4.6.1/System.Xml.dll -r:$(MONO_PATH)/external/binary-reference-assemblies/v4.6.1/System.Core.dll -r:$(MONO_PATH)/external/binary-reference-assemblies/v4.6.1/System.dll \
-resource:config -resource:config_mobile -resource:machine.4_5.config -resource:Info.plist.tmpl -resource:Info-framework.plist.tmpl $(tuner_sources) $(mmp_sources) -debug:portable -nologo -deterministic
$(Q) cp $(MONO_CECIL_DLL) $(MONO_CECIL_MDB_DLL) .
Mono.Cecil.dll: $(MONO_CECIL_DLL)

Просмотреть файл

@ -25,4 +25,5 @@
<dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
<dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
</dllmap>
<dllmap dll="System.Native" target="__Internal"/>
</configuration>

Просмотреть файл

@ -11,4 +11,5 @@
<dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
<dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
</dllmap>
<dllmap dll="System.Native" target="__Internal"/>
</configuration>

Просмотреть файл

@ -104,7 +104,7 @@ namespace MonoMac.Tuner {
MarkMethods (GetType (system, "System.Net.Configuration.WebRequestModulesSection"));
MarkMethods (GetType (system, "System.Net.HttpRequestCreator"));
MarkMethods (GetType (system, "System.Net.FileWebRequestCreator"));
MarkMethods (GetType (system, "System.Net.FtpRequestCreator"));
MarkMethods (GetType (system, "System.Net.FtpWebRequestCreator"));
// types we cannot find (statiscally or using machine.config)
MarkMethods (GetType (system, "System.ComponentModel.BooleanConverter"));

Просмотреть файл

@ -128,7 +128,7 @@
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
<settings>
<ipv6 enabled="false"/>

Просмотреть файл

@ -145,6 +145,12 @@
</Compile>
<Compile Include="..\..\external\mono\external\linker\linker\Linker\TypePreserve.cs">
<Link>Linker\TypePreserve.cs</Link>
</Compile>
<Compile Include="..\..\external\mono\external\linker\linker\Linker\AssemblyUtilities.cs">
<Link>Linker\AssemblyUtilities.cs</Link>
</Compile>
<Compile Include="..\..\external\mono\external\linker\linker\Linker\TypeNameParser.cs">
<Link>Linker\TypeNameParser.cs</Link>
</Compile>
<Compile Include="..\..\external\mono\external\linker\linker\Linker\XApiReader.cs">
<Link>Linker\XApiReader.cs</Link>

Просмотреть файл

@ -1,3 +1,3 @@
#!/bin/sh
/Library/Frameworks/Mono.framework/Commands/mono --debug @XAMARIN_MAC_PREFIX@/lib/mmp/mmp.exe "$@"
exec /Library/Frameworks/Mono.framework/Commands/mono --debug @XAMARIN_MAC_PREFIX@/lib/mmp/mmp.exe "$@"

Просмотреть файл

@ -30,9 +30,11 @@ LINKER_SOURCES = \
$(MONOLINKER)/Linker/MethodReferenceExtensions.cs \
$(MONOLINKER)/Linker/TypeReferenceExtensions.cs \
$(MONOLINKER)/Linker/TypePreserve.cs \
$(MONOLINKER)/Linker/TypeNameParser.cs \
$(MONOLINKER)/Linker/XApiReader.cs \
$(MONOLINKER)/Linker/Tracer.cs \
$(MONOLINKER)/Linker/MarkingHelpers.cs \
$(MONOLINKER)/Linker/AssemblyUtilities.cs \
$(MONOLINKER)/Linker.Steps/BaseStep.cs \
$(MONOLINKER)/Linker.Steps/BlacklistStep.cs \
$(MONOLINKER)/Linker.Steps/CleanStep.cs \