summaryrefslogtreecommitdiff
path: root/tests/src/Interop
AgeCommit message (Collapse)AuthorFilesLines
2019-01-11Enable returning more complex structures via PInvoke returns. (#21470)Jeremy Koritzinsky20-25/+274
* Add test verifying behavior in dotnet/coreclr#19676. * Clean up test code. * Test what happens if we enable returning structures by value. * Use braced initializer. * Update Decimal tests to expect that returning a decimal by LPStruct or Currency works. * Change handle-in-struct marshalling to expect a NotSupportedException thrown at marshal time instead of expecting a MarshalDirectiveException at signature time. * Update Decimal Reverse-PInvoke tests. * Disable some previously disabled return marshalling types and add a nice comment block explaining why they're disabled. * Enable marshalling DateTime return values and add a test. * Rename IsUnuspportedValueTypeReturn * Add return test for ArrayWithOffset * Remove extraneous P/Invoke. * Fix spelling. * Add test for successfully returning a struct that has one field of a type that is return-type blocked. * Add explicit struct return test. * Clean up tests. * Fix grammer. * Add test for struct whose managed layout doesn't require a stdcall return buffer but whose native layout does. * Add test verifying HandleRef behavior. * Clean up IsUnsupportedTypedefReturn per PR feedback.
2019-01-09Add tests for our layout-class marshalling (#20867)Jeremy Koritzinsky5-0/+351
* Add simple test for the LayoutClassMarshaler (most of the code is already covered by the struct marshalling tests). * Add test for blittable layout class. * Apparently layout classes are passed by value when passed as struct fields instead of byref.
2019-01-09Remove extraneous eightbytes check for native structures and add tests. (#21590)Jeremy Koritzinsky7-74/+338
* Remove extraneous eightbytes check and add tests. * Interger -> Integer * Missed Helper.cs * Handle field sizes larger than 8 bytes in AssignClassifiedEightByteTypes * Move CoreFX test case into CoreCLR. Fix the SystemV eightbyte classifier to correctly classify the second eightbyte when a single field crosses the eightbyte boundary (such as an in-place array of three 4-byte enums). * Enable passing user defined structs in in-place arrays in a structure if SystemV ABI expects it. * Correctly handle a field spanning two full eightbytes. * Just directly assign 0 to accumulatedSizeForEightByte * Change multi-eightbyte field handling to be a loop as per PR feedback. * Remove extraneous whitespace.
2019-01-08Extract cleanup changes from #21793. (#21852)Jeremy Koritzinsky2-2/+2
* Cleanup changes from #21793. * Emit the data pointer offset directly into the IL stream (and calculate it as needed instead of passing it through) * Fix broken assumption that OverrideProcArgs::na::m_pMT is the array type instead of the element type (which it was).
2019-01-07Fix CharSet on StringBuilder hidden null terminator test (#21853)Jeremy Koritzinsky1-2/+2
2019-01-05Move Native Library APIs to NativeLibrary class (#21821)Swaroop Sridhar6-387/+397
Move APIs that manipulate native libraries from System.Runtime.InteropServices.Marshal class to the new System.Runtime.InteropServices.NativeLibrary class. In API review: #32015, The LoadLibrary APIs were originally Approved to live in System.Runtime.InteropServices.Marshal class. However, recently the decision was changed such that the APIs are in a new NativeLibrary class.
2019-01-03Add test for StringBuilder null terminator implementation detail (#21800)Jeremy Koritzinsky3-1/+14
* Remove some commented out code. * Add test verifying that we put a null terminator 2-past the end of the native buffer allocated for a StringBuilder.
2019-01-03Use Kernel32 instead of api-ms-win-core-* in DllImports in SafeFileHandle.csEgor Chesakov1-5/+5
2019-01-03Bring Debug CRT DLLs when build IJW tests (#21699)Egor Chesakov3-0/+16
2018-12-17Do not use CorHost2::m_fStarted to gate execution (#20953)Steve MacLean1-4/+1
* ExecuteInDefaultAppDomain w/o Start Do not require Start() call before calling ExecuteInDefaultAppDomain() * Remove unused variable * Move flags as needed to CorHost2
2018-12-17Add tests for marshalling a System.Drawing.Color. (#21569)Jeremy Koritzinsky18-2/+211
2018-12-10Instead of using Win8+ api-sets use forwarder DLL to support downlevel ↵Aaron Robinson1-13/+16
versions of Windows. (#21469)
2018-12-07Add PNSE CustomMarshaler tests (for Tlbimp compat) (#21438)Jeremy Koritzinsky5-0/+107
2018-12-06Port CustomMarshalers.dll to C# and .NET Core (#21343)Jeremy Koritzinsky8-1/+408
* Import CustomMarshalers from corefx PR. * Add tests for marshalling IEnumerator and IEnumerable using the System.Runtime.InteropServices.CustomMarshalers. * Verify that the marshaller is used in the managed -> native direction in the tests. * Remove #if's * PR Feedback. * Move ComHelpers.h into interop common headers. * Add some template machinery to ensure that we don't accidentally pass in an incorrect type into DoQueryInterface. * Add VariantClear * Make marshalers internal and root them in ILLinkTrim.xml * Revert enable-if machinery. * Add tests for the pass-through unwrapping done by the EnumeratorToEnumVariantMarshaler. * Remove some of my helper code. * Added todo about exposing EnumerableToDispatchMarshaler. * PR Feedback. * Removed the last placement new. * Use the runtime hooks to enable us to not have to publically expose the custom marshalers. * Remove out of date comments.
2018-12-05Suppress a CMake Warning (#21147)Swaroop Sridhar1-0/+7
* Suppress a CMake Warning This change adds a local cmake_policy rule to suppress warnings about libraries with unicode names. ``` CMake Warning (dev) at tests/src/Interop/PInvoke/DllImportPath/CMakeLists.txt:14 (add_library): Policy CMP0037 is not set: Target names should not be reserved and should match a validity pattern. Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The target name "DllImportPath_U�n�i�c�o�d�e" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. This warning is for project developers. Use -Wno-dev to suppress it. ``` * Update tests/src/Interop/PInvoke/DllImportPath/CMakeLists.txt Co-Authored-By: swaroop-sridhar <Swaroop.Sridhar@microsoft.com>
2018-12-05Add tests for marshalling RuntimeHandle types. (#21091)Jeremy Koritzinsky6-0/+115
* Add tests for marshalling runtime handles. * Remove DLL signature for impossible test
2018-12-04Additional tests for type equivalence (#21340)Aaron Robinson1-1/+5
* Additional tests for type equivalence
2018-12-01Enable COM interop for collectible classes (#20919)Jan Vorlicek7-1/+179
* Enable COM interop for collectible classes * Modify DispatchInfo to use LoaderAllocator handles The DispatchMemberInfo was using global handles to refer to the managed MemberInfo instances. That doesn't work with unloadability. This change modifies it to use handles allocated from LoaderAllocator. * Disable COM interop for WinRT types * Remove collectible check from IsTypeVisibleFromCom. That fixes three new COM interop tests * Add collectible check to GetComClassFactory when we check for unsupported interop with WinRT * Add COM unloadability tests Add two tests to test COM unloadability: * One for using native COM server from managed COM client * One for using managed COM objects from native client * Add unloading test for IUnknownTest * Disable NETClientPrimitivesInALC on Win ARM The NETClientPrimitives is disabled there too.
2018-11-30Update how CoreDisTools is discovered (#21261)Aaron Robinson1-2/+0
* Update Disassembler logic to search for CoreDisTools next to binary _or_ under the path specified by CORE_ROOT * Update GCCover critical section
2018-11-29Add more advanced SafeArray tests (#21063)Jeremy Koritzinsky13-7/+994
* Port simple SafeArray tests over from .NET Framework's test suite. * Clean up native calling conventions. * Add basic field array -> field SAFEARRAY* tests. * Fix some hiding stdcall calling convention decorators. * PR Feedback. * Rewrite native part of SafeArray tests * Wrote the managed side of the tests. Non-passing ones are currently commented out. * Fix up tests and enable marshalling a string[] as a SAFEARRAY of LPSTR or LPWSTR. * Add blittable records test with a return parameter. * Add returning non-blittable record safearray test. * Fix which typedef we're using * Clean up * Fix/cleanup RecordNative * Replace "" with <> for platformdefines.h include. * Use macro for calling convention. * PR Feedback. * Remove residual "Helpers.h" include. * Fix remaining incorrect calling conventions. * One more calling convention fix.
2018-11-28Fix #21209 (#21237)Swaroop Sridhar1-5/+11
This commit has two changes to Native Load Library Tests fix the failures in: https://github.com/dotnet/coreclr/issues/21209 1) Windows: The test tried to load a DLL from Win32 directory which doesn't exist in Windows server 2016. So changed to use a file that exists. 2) Linux: Disable the test when run against packages -- because in this configuration the tests are built on Windows, and the native DLL is built separately and copied over to the CORE_ROOT directory instead of the test directory. [Several other tests are disabled with the comment "Issue building native DLL" on Linux]
2018-11-28exclude tests\src\Interop\COM\NativeClients\Primitives from GCStress runs. ↵Sergey Andreenko1-0/+2
(#21222) * exclude tests\src\Interop\COM\NativeClients\Primitives.csproj from GCStress runs. * fix alignment
2018-11-24Fix Interop/PInvoke/Miscellaneous/HandleRef tests under GCStress (#21131)Jeremy Koritzinsky1-15/+1
* Add GC.KeepAlive call in the IL stub when marshalling a HandleRef. * Add a GC.KeepAlive call for the BoxedInt since it isn't kept alive when running GC Stress * Reference HandleRef._handle via the binder instead of by field offset arithmetic * Alignment * Use Marshal.Alloc/FreeHGlobal instead of the weird no-pinning machinery that was failing before * Update HandleRefTest.cs
2018-11-22Typos (#21171)John Doe1-1/+1
* accesible -> accessible * acheive -> achieve * actutl -> actual * appied -> applied * apropriate -> appropriate * aprox -> approx * aquired -> acquired * argumemts -> arguments * Argumens -> Arguments * argumetn -> argument
2018-11-21Introduce Marshall.LoadLibrary API (#20871)Swaroop Sridhar5-0/+456
Implement Native LoadLibrary API This change commits the following changes: 1) Refactoring DllImport code to reuse LodLibrary by search for pInvoke and LoadLibrary cases 2) Implement the new Native Library API in System.Runtime.Interop.Marshall 3) Add tests for the new APIs
2018-11-18Add ICustomMarshaler tests (#19195)Hugh Bellamy3-0/+708
* Add ICustomMarshaler tests
2018-11-16Add PInvoke/Decimal tests (#19301)Zeng Jiang11-1/+1107
* Add PInvoke/Decimal Tests * Remove tests that fail on both .NET Framework and .NET Core. * Refactor away the Windows-only headers. * Make Decimal tests build on Linux. * Remove some dead code. * Clean up formatting. * Don't run Decimal <--> Currency tests off-Windows. * Make calling conventions and parameter/return marshalling more explicit
2018-11-15Add simple tests for ArrayWithOffset marshaling. (#21013)Jeremy Koritzinsky6-0/+143
* Add simple tests for ArrayWithOffset marshaling. * PR Feedback. * Fix visibility * Fix DllImport library name
2018-11-15Add Interop/PInvoke/Attributes tests (#19107)Zeng Jiang5-0/+349
* Add Interop/PInvoke/Attributes tests * Fix PR comments * Fix compile warnings * Remove comment * Clean up test files to match current build system. * Fix up test and make it windows only (as FEATURE_LCID is only enabled on Windows) * Fixed string const issues.
2018-11-15Add PInvoke/CriticalHandles tests (#19297)Zeng Jiang11-0/+1132
* Add PInvoke/CreticalHandles tests * Bring up to current infrastructure. * Fix ReverseTest.
2018-11-15Add PInvoke/SafeHandles tests (#19330)Zeng Jiang29-0/+4347
* Add PInvoke/SafeHandles tests * Fix compile warnings - include header file with relative path * Run SafeHandle tests only on Windows. The tests are very Windows-centric, so we'd have to do quite a bit of a re-write to get them working xplat. * Fix CMake project references. * Fix interface CMakeLists project reference. * Add casts for string literals. * Use LPOLESTR and the W macro instead of OLECHAR* cast and L prefix.
2018-11-15Add Tests for VBByRefStr marshalling (#20982)Jeremy Koritzinsky6-0/+143
* Add tests for VBByRefStr marshalling. * Compile native for VBByRefStr on all platforms. * Fix encoding. * PR Feedback. * Fix PInvokeDefs file. * Fix visibility
2018-11-15Add tests for marshalling as VARIANT_BOOL or VARIANT (#20856)Jeremy Koritzinsky9-29/+1858
* Add native side impl for VARIANT_BOOL test. * More bool native code. * Add VariantBool marshalling tests. * Add infrastructure for tests for object -> VARIANT marshalling. * Add variant tests for all built-in types. * Clean up Variant tests. * Add test for passing custom structure as object. * Add test for VARIANT_BOOL byref. * Added byref tests for VARIANT marshalling. * Add field marshalling tests for VARIANT. * Move ByValue tests to not have two sources of truth. * Make managed code the one source of truth. * Clean up formatting/unused methods. * Clean up some whitespace issues. * Add tests for BStrWrapper and CurrencyWrapper marshalling. * Add UnknownWrapper tests. * Add a test for VariantWrapper and PInvoke. * PR Feedback. * Remove ToString. * Fix visibility * Fix MSBuild import path. * Clean up Variant tests.
2018-11-15Add PInvoke/SizeParamIndex tests (#19348)Zeng Jiang22-0/+2417
* Add PInvoke/SizeParamIndex tests * Fix compile warnings * First pass cleaning up native code. * Get ParamSizeIndex tests working xplat (excluding the BSTR array tests) * Fix incorrect definition of ULONG off-windows. * Disable reverse-PInvoke throwing test off-Windows.
2018-11-15Add PInvoke/DllImportpath tests (#19270)Zeng Jiang5-0/+385
* Add PInvoke/DllImportpath tests * Refactor test to current toolset and remove Windows-only Path API searching. * Remove explicit calling convention from managed and add correct convention to test. * Get environment test passing on Unix. * Update test to pass off-Windows. * Include feature/platform defines in tests. * Fix environment test (again). * Remove zero-width character that's breaking CI * Fix zero-width character I missed. * Remove invalid parens around LD_LIBRARY_PATH * Ensure the path added to the LD_LIBRARY_PATH exists before the test starts. * Combine all DllImportPath CMakeLists.txt files into one file. * Include clr.coreclr.props when also including clr.defines.targets so we get the feature defines correctly as well. * Disable unicode test for our OSX 10.12 CI builds.
2018-11-15Add tests for ANSI BSTRs (#20985)Jeremy Koritzinsky7-1/+347
* Add tests for ANSI BSTRs * Fix signed/unsigned mismatch in comparisons. Add xplatform include * Use regular memcpy * Enable ANSI BSTR off-windows. * Also enable UnmanagedType.TBStr off-Windows since both BStr variants are available off-Windows. * Make sure the AnsiBSTR marshaller is hooked up off-Windows. * Remove a few more ifdefs I missed. * remove ifdefs around binder definitions and the C# stub helpers. * PR Feedback. * Add xplat ARRAYSIZE macro * Move xplat ARRAYSIZE to platformdefines.h
2018-11-15Add PInvoke/Array tests (#19266)Zeng Jiang17-1/+5729
* Add PInvoke/Array tests * Fix compile warnings * Get tests passing on Windows again. * Change error_t type to work xplat. * Change error_t in types.h as well * Clean up build slightly. * PR feedback and native test code refactoring. * Clean up header. * Add a xplat implementation of _itoa_s for our tests. * CHAR -> char * Make calling convention cdecl to avoid stdcall mangling. * Make return test native code cdecl as well (missed it before). * Fix bug in platformdefines _itoa_s * Return early in TP_itoX_s when num == 0
2018-11-15Add PInvoke/Miscellaneous tests (#19326)Zeng Jiang13-0/+435
* Add PInvoke/Miscellaneous tests * Clean up HandleRef test.
2018-11-14Fix invalid tests for COM native server (#21012)Aaron Robinson1-2/+5
2018-11-14Disable COM tests being CrossGen'd (#21010)Aaron Robinson3-0/+9
* Disable running CrossGen on COM tests since the CrossGen tool doesn't support app manifests on Windows. * Update ObjectStackAllocation test to use MSBuild property to disable CrossGen support.
2018-11-14Add test for marshalling ArgIterators on Windows (#20888)Jeremy Koritzinsky5-0/+132
* Add (windows-only) tests for __arglist and ArgIterator marshalling. * Add explicit calling convention notation to pinvokes. * Add license header * Update VarargsTest.cs * Fix calling conventions. * PR Feedback * Add explicit calling convention. * Update VarargsNative.cpp * Don't reference System.Private.Corelib directly
2018-11-13Add tests for AsAny Marshalling (#20963)Jeremy Koritzinsky7-3/+1049
* Copy over tests from .NET Framework. * Convert tests to use CoreCLRTestLibrary. Clean up tests that weren't self-consistent. * Pass in context for non best-fit-mapping tests. * Move around/group declarations. * Clean up typedef names/usage. * Fix signedness. * Use ptrdiff_t and size_t instead of C99 types. * Fix printf specifiers * Remove unneeded now duplicate typedef
2018-11-10Keep delegate fields alive across a full native call (#20896)Jeremy Koritzinsky1-5/+18
* Repurpose CleanupWorkList to also preserve delegate references in structs across the full native call. * Change CleanupWorkListElement to abstract base class instead of interface. * Make CleanupWorkList a singlely linked list. * PR Feedback. * Remove CleanupWorkList and make CleanupWorkListElement be able to represent the full list. * Add back throw in SafeHandle field marshalling. * PR feedback.
2018-11-10Add PInvoke/BestFitMapping tests (#19269)Zeng Jiang101-0/+14747
* Add PInvoke/BestFitMapping tests * Fix warning * Make native side of tests xplat. * Clean up managed side of the test build. * Disable BestFitMapping tests off Windows. * Individually disable tests. * Disable the two tests that I missed last time.
2018-11-06Disable running ILAsm round-trip build on COM Tests (#20822)Jeremy Koritzinsky3-0/+9
* Disable running ILAsm round-trip build on COM (requires ilasm resource embedding support). * ILAsmTestKind -> IlrtTestKind
2018-11-05Fix calling convention for 3 p/invoke test casesBruce Forstall1-1/+1
2018-10-31Add PInvoke/Structures testsJiang Zeng (Pactera Technologies Inc)18-0/+9167
Fix compile warnings Fix compile warnings Fix compile warnings Remove duplicate tests. Move ReversePinvoke tests under StructMarshalling. Clean up some compile errors. More string cleanup. More string fixes Clean up consts and typedefs. Fix typo. Change TP_slen return type to match xplatform.h Fix printf specifiers. Don't define wcslen in xplatform if it's been macro redefined (to platformdefines.h's TP_slen) Fix build breaks. Remove extension from DllImport so it will correctly resolve xplat. Fix printf specifiers again... Fix Windows x86 calling convention mismatch. Fix HRESULT size off-Windows
2018-10-31Add PInvoke/NativeCallManagedComVisible tests (#19328)Zeng Jiang10-1/+3509
* Add PInvoke/NativeCallManagedComVisible tests * Update to current infrastructure and disable off-Windows * Fix incorrect S_OK value and made the native side actually return an HRESULT in hr.
2018-10-30Add support for large number of argumets in CCW call on Arm64 (#20670)David Wrighton6-0/+108
* Fix CCW with large numbers of arguments on arm64 - Correctly align the stack in COMToCLRDispatchHelper - Add tests for naturally 16 byte aligned stack growth, and non-aligned growth * New many arguments COM test * Add support for the IL stub ETW diagnostic event
2018-10-25Add a runtime check for Windows.Nano to all COM related tests.Aaron Robinson5-0/+28