Skip to content

Commit e9778f1

Browse files
Add back removed APIs from the TileDB.Interop namespace. (#278)
* Add back removed APIs from the `TileDB.Interop` namespace. (#277) * Fix compile errors by making some interop types public again. * Obsolete the reintroduced interop APIs, with a new diagnostic ID.
1 parent 0959686 commit e9778f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+908
-29
lines changed

docs/obsoletions.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Following [the deprecation policy of TileDB Embedded][core-deprecation], obsolet
77
|Diagnostic codes|Deprecated in version|Removed in version|
88
|----------------|---------------------|------------------|
99
|[`TILEDB0001`](#TILEDB0001)[`TILEDB0011`](#TILEDB0011)|5.3.0|5.5.0|
10+
|[`TILEDB0012`](#TILEDB0012)[`TILEDB0012`](#TILEDB0012)|5.7.0|5.9.0|
1011

1112
## `TILEDB0001` - Enum value names that start with `TILEDB_` were replaced with C#-friendly names.
1213

@@ -299,4 +300,23 @@ Some of these methods were renamed or had their signature changed (for example t
299300

300301
Instead of setting ranges and subarrays on the `Query`, create and configure a `Subarray` object, and assign it to the query using the `Query.SetSubarray` method.
301302

303+
## `TILEDB0012` - Members of the `TileDB.Interop` namespace will become internal in a future version and should not be used by user code.
304+
305+
<a name="TILEDB0012"></a>
306+
307+
Some APIs in the `TileDB.Interop` namespace that were inadvertently removed in version 5.3.0 were reintroduced in version 5.7.0. They are marked as obsolete and hidden from IntelliSense and will be removed from the public API for good in version 5.9.0. They were also reintroduced in patch releases 5.3.1 and 5.4.1, obsoleted under the [`TILEDB0003`](#TILEDB0003) code.
308+
309+
### Version introduced
310+
311+
5.7.0
312+
313+
### Recommended action
314+
315+
The obsoleted APIs fall into the following categories:
316+
317+
- The `MarshaledString` and `MarshaledStringOut` types are used to help convert strings from and to ASCII and pass them to native code. If you are using them in user code for native code interop, you should use .NET's [built-in P/Invoke](https://learn.microsoft.com/en-us/dotnet/standard/native-interop/charset) marshaling instead. For other kinds of encoding conversions, you should use APIs from the [`System.Text.Encoding`](https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding) class.
318+
- The `__sFile` and `LibC` types have no members and there is no reason to use them anyway.
319+
- The types that derive from `SafeHandle` are used to safely manage the lifetime of native TileDB objects. With the APIs in the `TileDB.CSharp` namespace providing broad coverage of TileDB's functionalities while also being safer and easier to sue, these types provide limited utility. You should use the APIs in the `TileDB.CSharp` namespace instead.
320+
- Types with the name `tiledb_***_t` were made public again only to support the APIs of the safe handles above. They have little other use on their own. You should use APIs in the `TileDB.CSharp` namespace instead.
321+
302322
[core-deprecation]: https://github.com/TileDB-Inc/TileDB/blob/dev/doc/policy/api_changes.md

sources/TileDB.CSharp/Array.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
using TileDB.CSharp.Marshalling;
66
using TileDB.CSharp.Marshalling.SafeHandles;
77
using TileDB.Interop;
8+
using ArrayHandle = TileDB.CSharp.Marshalling.SafeHandles.ArrayHandle;
9+
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;
10+
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
811

912
namespace TileDB.CSharp
1013
{

sources/TileDB.CSharp/ArraySchema.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
using System.Collections.Generic;
33
using TileDB.CSharp.Marshalling.SafeHandles;
44
using TileDB.Interop;
5+
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;
6+
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;
7+
using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle;
8+
using AttributeHandle = TileDB.CSharp.Marshalling.SafeHandles.AttributeHandle;
59

610
namespace TileDB.CSharp
711
{

sources/TileDB.CSharp/ArraySchemaEvolution.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using TileDB.CSharp.Marshalling.SafeHandles;
33
using TileDB.Interop;
4+
using ArraySchemaEvolutionHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaEvolutionHandle;
45

56
namespace TileDB.CSharp
67
{

sources/TileDB.CSharp/Attribute.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
using System.Linq;
33
using System.Runtime.InteropServices;
44
using System.Text;
5-
using TileDB.CSharp.Marshalling.SafeHandles;
65
using TileDB.Interop;
6+
using TileDB.CSharp.Marshalling.SafeHandles;
7+
using AttributeHandle = TileDB.CSharp.Marshalling.SafeHandles.AttributeHandle;
8+
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;
79

810
namespace TileDB.CSharp
911
{

sources/TileDB.CSharp/Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Text;
33
using TileDB.CSharp.Marshalling.SafeHandles;
44
using TileDB.Interop;
5+
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
56

67
namespace TileDB.CSharp
78
{

sources/TileDB.CSharp/ConfigIterator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using TileDB.CSharp.Marshalling.SafeHandles;
33
using TileDB.Interop;
4+
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
5+
using ConfigIteratorHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigIteratorHandle;
46

57
namespace TileDB.CSharp
68
{

sources/TileDB.CSharp/Context.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using System.Text;
88
using TileDB.CSharp.Marshalling.SafeHandles;
99
using TileDB.Interop;
10+
using ContextHandle = TileDB.CSharp.Marshalling.SafeHandles.ContextHandle;
11+
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
1012

1113
namespace TileDB.CSharp
1214
{

sources/TileDB.CSharp/Dimension.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using TileDB.CSharp.Marshalling;
55
using TileDB.CSharp.Marshalling.SafeHandles;
66
using TileDB.Interop;
7+
using DimensionHandle = TileDB.CSharp.Marshalling.SafeHandles.DimensionHandle;
8+
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;
79

810
namespace TileDB.CSharp
911
{

sources/TileDB.CSharp/Domain.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using TileDB.CSharp.Marshalling.SafeHandles;
33
using TileDB.Interop;
4+
using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle;
5+
using DimensionHandle = TileDB.CSharp.Marshalling.SafeHandles.DimensionHandle;
46

57
namespace TileDB.CSharp
68
{

sources/TileDB.CSharp/File.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.ComponentModel;
22
using TileDB.CSharp.Marshalling.SafeHandles;
33
using TileDB.Interop;
4+
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;
45

56
namespace TileDB.CSharp
67
{

sources/TileDB.CSharp/Filter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Runtime.InteropServices;
44
using TileDB.CSharp.Marshalling.SafeHandles;
55
using TileDB.Interop;
6+
using FilterHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterHandle;
67

78
namespace TileDB.CSharp
89
{

sources/TileDB.CSharp/FilterList.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using TileDB.CSharp.Marshalling.SafeHandles;
33
using TileDB.Interop;
4+
using FilterHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterHandle;
5+
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;
46

57
namespace TileDB.CSharp
68
{

sources/TileDB.CSharp/FragmentInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using TileDB.CSharp.Marshalling;
44
using TileDB.CSharp.Marshalling.SafeHandles;
55
using TileDB.Interop;
6+
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;
7+
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
68

79
namespace TileDB.CSharp
810
{

sources/TileDB.CSharp/Group.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using TileDB.CSharp.Marshalling.SafeHandles;
33
using TileDB.Interop;
4+
using GroupHandle = TileDB.CSharp.Marshalling.SafeHandles.GroupHandle;
5+
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
46

57
namespace TileDB.CSharp
68
{
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.ComponentModel;
2+
using System;
3+
using TileDB.CSharp;
4+
5+
namespace TileDB.Interop
6+
{
7+
[Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
8+
[EditorBrowsable(EditorBrowsableState.Never)]
9+
// placeholder struct to avoid errors loading generated code
10+
public partial struct __sFILE
11+
{
12+
}
13+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
2+
//https://github.com/dotnet/ClangSharp/blob/67c1e5243b9d58f2b28f10e3f9a82f7537fd9d88/sources/ClangSharp.Interop/Internals/SpanExtensions.cs
3+
4+
using System;
5+
using System.ComponentModel;
6+
using System.Text;
7+
using TileDB.CSharp;
8+
9+
namespace TileDB.Interop
10+
{
11+
[Obsolete(Obsoletions.TileDBInteropMessage, DiagnosticId = Obsoletions.TileDBInteropDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
12+
[EditorBrowsable(EditorBrowsableState.Never)]
13+
public static unsafe class SpanExtensions
14+
{
15+
public static string AsString(this Span<byte> self) => AsString((ReadOnlySpan<byte>)self);
16+
17+
public static string AsString(this ReadOnlySpan<byte> self)
18+
{
19+
if (self.IsEmpty)
20+
{
21+
return string.Empty;
22+
}
23+
24+
fixed (byte* pSelf = self)
25+
{
26+
return Encoding.ASCII.GetString(pSelf, self.Length);
27+
}
28+
}
29+
}
30+
31+
}//namespace

0 commit comments

Comments
 (0)