Commit Graph
1094 Commits
Author SHA1 Message Date
Michal Strehovský 4733c70d09 Manifest DllImportSourceGenerator as a generator (#62836) 2021-12-15 08:51:38 -08:00
SingleAccretion ca072ba73c Fix invalid IR in span indexer import (#62709)
* Fix invalid IR in Span[] import

* Re-enable disabled tests
2021-12-13 17:15:49 +03:00
Julien Couvreur ab0de531c8 Escape lower-cased type names (#62507) 2021-12-09 00:05:25 -08:00
Jeremy KoritzinskyandAaron Robinson b83fee9f6e Use GeneratedDllImport throughout System.Private.CoreLib. (#62295)
Co-authored-by: Aaron Robinson <[email protected]>
2021-12-02 16:15:47 -08:00
Jeremy KoritzinskyandAndy Gocke 84b55d9700 Remove workarounds for referencing the DllImport source generator now that we use the RTM sdk. (#62156)
Co-authored-by: Andy Gocke <[email protected]>
2021-11-30 13:48:15 -08:00
Aaron Robinson 7cfcbb0fe6 The DestroyStructure API passes null to the IL marshaller for (#61985)
managed valuetypes. This is an issue with field marshallers of
  nested non-blittable types.
2021-11-24 12:23:22 -07:00
Jeremy KoritzinskyandAaron Robinson 06a0c76a81 Update GetPinnableReference() usage in multi-step custom type marshalling (#61539)
* Update GetPinnableReference() usage in multi-step custom tyep marshalling

Change GetPinnableReference() on a marshaller type to be used as a side effect when marshalling in all cases when a fixed() statement is usable.

Use the Value property getter to get the value to pass to native in all cases.

Update our marshallers and tests to follow this design update.

* Apply suggestions from code review

Co-authored-by: Aaron Robinson <[email protected]>

* Don't emit the assingment to the Value property in the Unmarshal stage when using [Out]

* Fix the unmarshalling conditions

* Fix Utf16StringMarshaller to correctly handle the "null pointer" case now that we're using spans internally for storage in all cases.

Co-authored-by: Aaron Robinson <[email protected]>
2021-11-19 18:16:07 -08:00
Elinor Fung 4254fa30b7 [DllImportGenerator] Don't flag methods with known unsupported UnmanagedType (#61808) 2021-11-18 18:56:00 -07:00
Jeremy Koritzinsky 7f874eee5a Remove race condition from DllImportGenerator build (#61695) 2021-11-17 18:10:56 -08:00
Elinor Fung a508fb574c [DllImportGenerator] Enable on projects without System.Memory and System.Runtime.CompilerServices.Unsafe (#61704) 2021-11-17 09:12:15 -07:00
Elinor Fung 80765225d8 [DllImportGenerator] Stop ignoring QCalls when looking for methods to convert to GeneratedDllImport (#61678) 2021-11-16 15:12:40 -07:00
Elinor Fung 0818df12f8 [DllImportGenerator] Treat pointer fields in structs as blittable regardless of what they point at (#61538) 2021-11-12 19:08:39 -08:00
Aaron Robinson e7600e0080 Remove all DLLIMPORTGENERATOR_ENABLED usage. (#61476)
* Remove all DLLIMPORTGENERATOR_ENABLED usage.

* Explicitly set EnableDllImportGenerator to true in test project.
2021-11-12 11:08:39 -08:00
Elinor Fung 4f43e82fcb [DllImportGenerator] Initialize by-value out array to default (#61431) 2021-11-10 15:27:59 -08:00
Elinor Fung 9dc08dd7d0 Remove BestFitMapping, CallingConvention, and ThrowOnUnmappableChar from GeneratedDllImportAttribute (#61182) 2021-11-05 21:24:50 -07:00
Aaron Robinson f080744f70 Convert to OleDb assembly and last Cryptography DllImport to GeneratedDllImport (#61184)
* Enable DllImport generator for all source projects.

* Convert OleDb to only use GeneratedDllImport.

* Update source generator to distinguish between "no marshalling info"
  which can cause a failure vs "missing support" which enables us to
  fallback to the marshalling forwarder.

* Remove unused DllImports.

* Reuse existing P/Invoke definitions.
2021-11-05 17:09:05 -07:00
Jeremy Koritzinsky 82d667c657 [DllImportGenerator] Use ElementMarshallingGeneratorFactory to create the marshalling generator for collection elements (#61219) 2021-11-04 16:16:30 -07:00
Elinor Fung 22f06831ae [DllImportGenerator] Fix stub generation for char array marshalling (#61188) 2021-11-03 22:49:01 -07:00
Aaron RobinsonandElinor Fung 6527f540e4 Add TFM and version support query to marshaller interface. (#61064)
* Add TFM and version support query to marshaller interface.

* If any marshaller fails to support the current tfm version, fallback
to using the built-in DllImport attribute.

* Add tests for fallback generation on downlevel or generation if marshallers
  are supported on the target framework.

* Convert CreateCompilationWithReferenceAssemblies to CreateCompilation overload.

Co-authored-by: Elinor Fung <[email protected]>
2021-11-02 21:27:34 -07:00
Elinor Fung 8dfaac9649 Mark containing type for generated stub functions as unsafe (#60979) 2021-10-28 18:22:32 -07:00
Jeremy Koritzinsky 1ba75a614e Explicitly emit a diagnostic for ref returns in GeneratedDllImport stubs. (#60720) 2021-10-28 10:51:55 -07:00
Elinor Fung 197ab5f77c [DllImportGenerator] Don't flag methods that already have GeneratedDllImport (#60929) 2021-10-27 17:42:04 -07:00
Elinor Fung c4ba63951e Make PreferredAttributeOrder test ConditionalTheory (#60940) 2021-10-27 17:39:23 -07:00
Krzysztof Wicher 7414b45bfa disable DllImportGenerator.UnitTests.ConvertToGeneratedDllImportAnalyzerTests.TypeRequiresMarshalling_ReportsDiagnostic (#60911) 2021-10-27 16:33:25 +02:00
Adeel Mujahid 7ac806d733 Fix libs.tests build with gcc (#60757) 2021-10-26 16:37:10 -07:00
Viktor Hofer 0964be0ae9 Update slngen and solution files (#60871)
Update slngen tooling to latest stable version and solution files since
a lot changed since the last time they were updated:
- NET7 (removal of older TFMs)
- Source Generators
2021-10-26 21:23:54 +02:00
Elinor Fung df9e3ac74f [DllImportGenerator] Stop flagging methods with well-known unsupported types for conversion (#60841)
* Make analyzer stop flagging methods with well-known unsupported types for conversion
* Make fixer put attribute arguments in preferred order
2021-10-26 08:16:32 -07:00
Elinor Fung d2ca8e1422 [DllImportGenerator] Skip unit tests that hit exceptions due to roslyn-sdk#590 (#60848) 2021-10-25 20:15:01 -07:00
Andy Gocke 8b91223e38 Skip more failing DllImport tests (#60836)
Follow-up on https://github.com/dotnet/runtime/pull/60773
2021-10-25 13:06:50 -07:00
Jeremy Koritzinsky 4b187afd2c Disable tests that are failing with JIT asserts on ARM64 (#60773) 2021-10-22 13:33:46 -07:00
Elinor Fung abcee5705a Remove unnecessary initialization of variables in generated code (#60748) 2021-10-22 10:50:58 -07:00
Elinor Fung d16fffdd00 Fix intermittent failure in DllImportGenerator unit tests when resolving assemblies (#60722) 2021-10-21 14:59:34 -07:00
Elinor Fung 55984c892c Stop adding unnecessary variable when marshalling UTF-16 string by value (#60708) 2021-10-21 12:47:27 -07:00
Jeremy Koritzinsky c58f31a504 Disable failing DllImportGenerator.Tests.BooleanTests.ValidateBoolIsMarshalledAsExpected test for Mono (#60692) 2021-10-20 15:59:53 -07:00
Elinor Fung 3eecfcdf74 Make unit tests for DllImportGenerator build/run in CI (#60598) 2021-10-20 08:51:41 -07:00
Jeremy KoritzinskyandJan Kotas ee4a76d37f [DllImportGenerator] Don't generate a full stub body when the body does nothing (#60601)
Co-authored-by: Jan Kotas <[email protected]>
2021-10-20 08:51:27 -07:00
Jeremy Koritzinsky 8990b0acbd Disable ClearPreviousError test on Mono (#60272) 2021-10-11 15:32:31 -07:00
Jeremy Koritzinsky 45c1dc3a32 Re-enable running DllImportGenerator.Tests suite on Mono. (#60259) 2021-10-11 11:19:06 -07:00
Jeremy Koritzinsky 2dff7cd61b Dllimport generator build and test fixes (#59658) 2021-10-06 09:40:26 -07:00
Elinor Fung b4773b0ca2 Fix IDE0008 in DllImportGenerator and Microsoft.Interop.SourceGeneration (#59885) 2021-10-04 15:45:27 -07:00
Elinor Fung 853297ab1f Update DllImportGenerator style to match repo conventions (#59753) 2021-09-30 16:21:24 -07:00
Elinor Fung 27d5e8dd3c Fix null termination for generated marshalling of read-only ref string (#59726) 2021-09-28 15:04:42 -07:00
Elinor Fung b7283efb78 Make Utf16CharMarshaller pin ref parameters (#59700) 2021-09-28 13:45:46 -07:00
Elinor Fung 3f78928969 Enable running analyzers on DllImportGenerator and Microsoft.Interop.SourceGeneration (#59683) 2021-09-27 17:40:23 -07:00
Aaron Robinson 7c87cc1aa5 Add license banner to source. (#59586) 2021-09-24 14:21:57 -07:00
Jeremy Koritzinsky 27034bc84b Run slngen to regenerate the solution files. 2021-09-22 17:02:14 -07:00
Jeremy Koritzinsky 4cfb51f0ce Hook up DllImportGenerator to the libraries build (excluding solution file regeneration).
Move System.Runtime.InteropServices unit tests to a subdirectory.
2021-09-22 17:02:14 -07:00
Jeremy Koritzinsky fc18f4de2e Merge branch 'feature/DllImportGenerator' of /home/jekoritz/scratch/bash/dllimportgenerator into port-dllimport-generator 2021-09-20 09:15:15 -07:00
Aaron Robinson 7eea82a460 Remove duplicate TypeNames.cs and create IntPtr constant. (dotnet/runtimelab#1550)
Commit migrated from https://github.com/dotnet/runtimelab/commit/fb867cdfb646a4eecddb3eb91baa4709811872b5
2021-09-10 17:31:31 -07:00
Jeremy Koritzinsky 2449c469dc Refactor DllImportGenerator project for easier extensibility (dotnet/runtimelab#1119)
Commit migrated from https://github.com/dotnet/runtimelab/commit/9ac16c6c9f47100ea91db6231ad47f4a8d6ca946
2021-09-10 15:25:16 -07:00