Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/dlls/mscorrc/mscorrc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_EE_THREAD_APARTMENT_NOT_SUPPORTED "The system does not support the %1 thread apartment."
IDS_EE_NDIRECT_UNSUPPORTED_SIG "Method's type signature is not PInvoke compatible."
IDS_EE_NDIRECT_UNSUPPORTED_UNMANAGEDCALLERSONLY "Method '%1.%2' cannot be marked with both DllImportAttribute and UnmanagedCallersOnlyAttribute."
IDS_EE_COM_UNSUPPORTED_SIG "Method's type signature is not Interop compatible."
IDS_EE_COM_UNSUPPORTED_TYPE "The method returned a COM Variant type that is not Interop compatible."
IDS_EE_MULTIPLE_CALLCONV_UNSUPPORTED "Multiple unmanaged calling conventions are specified. Only a single calling convention is supported."
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/dlls/mscorrc/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define IDS_DS_DSOTHREADMODEL 0x1707

#define IDS_EE_NDIRECT_UNSUPPORTED_SIG 0x1708
#define IDS_EE_NDIRECT_UNSUPPORTED_UNMANAGEDCALLERSONLY 0x1709
#define IDS_EE_NDIRECT_BADNATL 0x170a
#define IDS_EE_NDIRECT_LOADLIB_WIN 0x170b
#define IDS_EE_NDIRECT_GETPROCADDRESS_WIN 0x170c
Expand Down
9 changes: 7 additions & 2 deletions src/coreclr/vm/dllimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3415,7 +3415,6 @@ BOOL NDirect::MarshalingRequired(
return FALSE;
}


// factorization of CreateNDirectStubWorker
static MarshalInfo::MarshalType DoMarshalReturnValue(MetaSig& msig,
mdParamDef* params,
Expand Down Expand Up @@ -4291,7 +4290,13 @@ static void CreateNDirectStubAccessMetadata(
// P/Invoke marked with UnmanagedCallersOnlyAttribute is not
// presently supported.
if (pMD->HasUnmanagedCallersOnlyAttribute())
COMPlusThrow(kNotSupportedException, IDS_EE_NDIRECT_UNSUPPORTED_SIG);
{
SString namespaceOrClassName;
SString methodName;
pMD->GetMethodInfoNoSig(namespaceOrClassName, methodName);
COMPlusThrow(kNotSupportedException, IDS_EE_NDIRECT_UNSUPPORTED_UNMANAGEDCALLERSONLY,
namespaceOrClassName.GetUnicode(), methodName.GetUnicode());
}

// Check to see if we need to do LCID conversion.
lcidArg = GetLCIDParameterIndex(pMD);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3582,7 +3582,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
* In AOT mode and embedding scenarios, it is possible that the icall is not registered in the runtime doing the AOT compilation.
* Emit a wrapper that throws a NotSupportedException.
*/
get_marshal_cb ()->mb_emit_exception (mb, "System", "NotSupportedException", "Method canot be marked with both DllImportAttribute and UnmanagedCallersOnlyAttribute");
get_marshal_cb ()->mb_emit_exception (mb, "System", "NotSupportedException", "Method cannot be marked with both DllImportAttribute and UnmanagedCallersOnlyAttribute");
goto emit_exception_for_error;
} else if (!pinvoke && !piinfo->addr && !aot) {
/* if there's no code but the error isn't set, just use a fairly generic exception. */
Expand Down
Loading