From 130519ccf347a14ced8c790261f41dc394aefb57 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Mon, 8 Jan 2024 21:19:52 +0200 Subject: [PATCH 01/10] Remove public APIs obsoleted under code TILEDB0012. --- sources/TileDB.CSharp/Interop/InteropAux.cs | 13 - .../TileDB.CSharp/Interop/SpanExtensions.cs | 31 - .../TileDB.CSharp/Interop/TileDBSafeHandle.cs | 663 ------------------ .../tiledb_array_schema_evolution_t.cs | 8 +- .../Interop/tiledb_array_schema_t.cs | 8 +- .../TileDB.CSharp/Interop/tiledb_array_t.cs | 8 +- .../Interop/tiledb_attribute_t.cs | 8 +- .../Interop/tiledb_config_iter_t.cs | 8 +- .../TileDB.CSharp/Interop/tiledb_config_t.cs | 8 +- sources/TileDB.CSharp/Interop/tiledb_ctx_t.cs | 8 +- .../Interop/tiledb_dimension_t.cs | 8 +- .../TileDB.CSharp/Interop/tiledb_domain_t.cs | 8 +- .../Interop/tiledb_filter_list_t.cs | 8 +- .../TileDB.CSharp/Interop/tiledb_filter_t.cs | 8 +- .../TileDB.CSharp/Interop/tiledb_group_t.cs | 8 +- .../Interop/tiledb_query_condition_t.cs | 8 +- .../TileDB.CSharp/Interop/tiledb_query_t.cs | 8 +- sources/TileDB.CSharp/Interop/tiledb_vfs_t.cs | 8 +- .../Marshalling/MarshaledString.cs | 5 +- .../Marshalling/MarshaledStringOut.cs | 24 +- 20 files changed, 18 insertions(+), 838 deletions(-) delete mode 100644 sources/TileDB.CSharp/Interop/InteropAux.cs delete mode 100644 sources/TileDB.CSharp/Interop/SpanExtensions.cs delete mode 100644 sources/TileDB.CSharp/Interop/TileDBSafeHandle.cs diff --git a/sources/TileDB.CSharp/Interop/InteropAux.cs b/sources/TileDB.CSharp/Interop/InteropAux.cs deleted file mode 100644 index 550fb248..00000000 --- a/sources/TileDB.CSharp/Interop/InteropAux.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.ComponentModel; -using System; -using TileDB.CSharp; - -namespace TileDB.Interop -{ - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - // placeholder struct to avoid errors loading generated code - public partial struct __sFILE - { - } -} \ No newline at end of file diff --git a/sources/TileDB.CSharp/Interop/SpanExtensions.cs b/sources/TileDB.CSharp/Interop/SpanExtensions.cs deleted file mode 100644 index 07041740..00000000 --- a/sources/TileDB.CSharp/Interop/SpanExtensions.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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. -//https://github.com/dotnet/ClangSharp/blob/67c1e5243b9d58f2b28f10e3f9a82f7537fd9d88/sources/ClangSharp.Interop/Internals/SpanExtensions.cs - -using System; -using System.ComponentModel; -using System.Text; -using TileDB.CSharp; - -namespace TileDB.Interop -{ - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public static unsafe class SpanExtensions - { - public static string AsString(this Span self) => AsString((ReadOnlySpan)self); - - public static string AsString(this ReadOnlySpan self) - { - if (self.IsEmpty) - { - return string.Empty; - } - - fixed (byte* pSelf = self) - { - return Encoding.ASCII.GetString(pSelf, self.Length); - } - } - } - -}//namespace \ No newline at end of file diff --git a/sources/TileDB.CSharp/Interop/TileDBSafeHandle.cs b/sources/TileDB.CSharp/Interop/TileDBSafeHandle.cs deleted file mode 100644 index 864b4061..00000000 --- a/sources/TileDB.CSharp/Interop/TileDBSafeHandle.cs +++ /dev/null @@ -1,663 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.InteropServices; -using TileDB.CSharp; - -namespace TileDB.Interop -{ - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class ConfigHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - - public ConfigHandle() : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_config_t*[1]; - var e = stackalloc tiledb_error_t*[1]; - Methods.tiledb_config_alloc(h, e); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_config_t*)handle; - Methods.tiledb_config_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_config_t* h) { SetHandle((IntPtr)h); } - private protected ConfigHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(ConfigHandle h) => h.handle; - public static implicit operator tiledb_config_t*(ConfigHandle h) => (tiledb_config_t*)h.handle; - public static implicit operator ConfigHandle(tiledb_config_t* value) => new ConfigHandle((IntPtr)value); - }//public unsafe partial class ConfigHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class ConfigIteratorHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - - public ConfigIteratorHandle(ConfigHandle hconfig, string prefix) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_config_iter_t*[1]; - var e = stackalloc tiledb_error_t*[1]; - var ms_prefix = new MarshaledString(prefix); - Methods.tiledb_config_iter_alloc(hconfig, ms_prefix, h, e); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHTha andle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_config_iter_t*)handle; - Methods.tiledb_config_iter_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_config_iter_t* h) { SetHandle((IntPtr)h); } - private protected ConfigIteratorHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(ConfigIteratorHandle h) => h.handle; - public static implicit operator tiledb_config_iter_t*(ConfigIteratorHandle h) => (tiledb_config_iter_t*)h.handle; - public static implicit operator ConfigIteratorHandle(tiledb_config_iter_t* value) => new ConfigIteratorHandle((IntPtr)value); - }//public unsafe partial class ConfigHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class ContextHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public ContextHandle() : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_ctx_t*[1]; - var hconfig = new ConfigHandle(); - Methods.tiledb_ctx_alloc(hconfig, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - public ContextHandle(ConfigHandle hconfig) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_ctx_t*[1]; - Methods.tiledb_ctx_alloc(hconfig, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_ctx_t*)handle; - Methods.tiledb_ctx_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_ctx_t* h) { SetHandle((IntPtr)h); } - private protected ContextHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(ContextHandle h) => h.handle; - public static implicit operator tiledb_ctx_t*(ContextHandle h) => (tiledb_ctx_t*)h.handle; - public static implicit operator ContextHandle(tiledb_ctx_t* value) => new ContextHandle((IntPtr)value); - }//public unsafe partial class ContextHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class FilterHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - - public FilterHandle(ContextHandle hcontext, tiledb_filter_type_t filterType) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_filter_t*[1]; - - Methods.tiledb_filter_alloc(hcontext, filterType, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_filter_t*)handle; - Methods.tiledb_filter_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_filter_t* h) { SetHandle((IntPtr)h); } - private protected FilterHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(FilterHandle h) => h.handle; - public static implicit operator tiledb_filter_t*(FilterHandle h) => (tiledb_filter_t*)h.handle; - public static implicit operator FilterHandle(tiledb_filter_t* value) => new FilterHandle((IntPtr)value); - }//public unsafe partial class FilterHandle - - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class FilterListHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public FilterListHandle(ContextHandle hcontext) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_filter_list_t*[1]; - - Methods.tiledb_filter_list_alloc(hcontext, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_filter_list_t*)handle; - Methods.tiledb_filter_list_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_filter_list_t* h) { SetHandle((IntPtr)h); } - private protected FilterListHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(FilterListHandle h) => h.handle; - public static implicit operator tiledb_filter_list_t*(FilterListHandle h) => (tiledb_filter_list_t*)h.handle; - public static implicit operator FilterListHandle(tiledb_filter_list_t* value) => new FilterListHandle((IntPtr)value); - }//public unsafe partial class FilterListHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe partial class VFSHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - - public VFSHandle(ContextHandle hcontext, ConfigHandle hconfig) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_vfs_t*[1]; - - int status = TileDB.Interop.Methods.tiledb_vfs_alloc(hcontext, hconfig, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - tiledb_vfs_t* p = (tiledb_vfs_t*)handle; - TileDB.Interop.Methods.tiledb_vfs_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public UInt64 get() { return (UInt64)this.handle; } - private protected void SetHandle(tiledb_vfs_t* h) { SetHandle((IntPtr)h); } - private protected VFSHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => this.handle == IntPtr.Zero; - public static implicit operator IntPtr(VFSHandle h) => h.handle; - public static implicit operator tiledb_vfs_t*(VFSHandle h) => (tiledb_vfs_t*)h.handle; - public static implicit operator VFSHandle(tiledb_vfs_t* value) => new VFSHandle((IntPtr)value); - }//public unsafe partial class VFSHandle - - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class AttributeHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public AttributeHandle(ContextHandle hcontext, string name, tiledb_datatype_t datatype) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_attribute_t*[1]; - - var ms_name = new MarshaledString(name); - Methods.tiledb_attribute_alloc(hcontext, ms_name, datatype, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_attribute_t*)handle; - Methods.tiledb_attribute_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_attribute_t* h) { SetHandle((IntPtr)h); } - private protected AttributeHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(AttributeHandle h) => h.handle; - public static implicit operator tiledb_attribute_t*(AttributeHandle h) => (tiledb_attribute_t*)h.handle; - public static implicit operator AttributeHandle(tiledb_attribute_t* value) => new AttributeHandle((IntPtr)value); - }//public unsafe partial class AttributeHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class DimensionHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - - public DimensionHandle(ContextHandle hcontext, string name, tiledb_datatype_t datatype, void* dimDomain, void* tileExtent) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_dimension_t*[1]; - - var ms_name = new MarshaledString(name); - - Methods.tiledb_dimension_alloc(hcontext, ms_name, datatype, dimDomain, tileExtent, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_dimension_t*)handle; - Methods.tiledb_dimension_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_dimension_t* h) { SetHandle((IntPtr)h); } - private protected DimensionHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(DimensionHandle h) => h.handle; - public static implicit operator tiledb_dimension_t*(DimensionHandle h) => (tiledb_dimension_t*)h.handle; - public static implicit operator DimensionHandle(tiledb_dimension_t* value) => new DimensionHandle((IntPtr)value); - }//public unsafe partial class DimensionHandle - - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class DomainHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - - public DomainHandle(ContextHandle hcontext) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_domain_t*[1]; - - Methods.tiledb_domain_alloc(hcontext, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_domain_t*)handle; - Methods.tiledb_domain_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_domain_t* h) { SetHandle((IntPtr)h); } - private protected DomainHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(DomainHandle h) => h.handle; - public static implicit operator tiledb_domain_t*(DomainHandle h) => (tiledb_domain_t*)h.handle; - public static implicit operator DomainHandle(tiledb_domain_t* value) => new DomainHandle((IntPtr)value); - }//public unsafe partial class DomainHandle - - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class ArraySchemaHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public ArraySchemaHandle(ContextHandle contextHandle, tiledb_array_type_t arrayType) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_array_schema_t*[1]; - - Methods.tiledb_array_schema_alloc(contextHandle, arrayType, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_array_schema_t*)handle; - Methods.tiledb_array_schema_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_array_schema_t* h) { SetHandle((IntPtr)h); } - private protected ArraySchemaHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(ArraySchemaHandle h) => h.handle; - public static implicit operator tiledb_array_schema_t*(ArraySchemaHandle h) => (tiledb_array_schema_t*)h.handle; - public static implicit operator ArraySchemaHandle(tiledb_array_schema_t* value) => new ArraySchemaHandle((IntPtr)value); - }//public unsafe partial class ArraySchemaHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class ArrayHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public ArrayHandle(ContextHandle contextHandle, sbyte* uri) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_array_t*[1]; - - Methods.tiledb_array_alloc(contextHandle, uri, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_array_t*)handle; - Methods.tiledb_array_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_array_t* h) { SetHandle((IntPtr)h); } - private protected ArrayHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(ArrayHandle h) => h.handle; - public static implicit operator tiledb_array_t*(ArrayHandle h) => (tiledb_array_t*)h.handle; - public static implicit operator ArrayHandle(tiledb_array_t* value) => new ArrayHandle((IntPtr)value); - }//public unsafe partial class ArrayHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class ArraySchemaEvolutionHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public ArraySchemaEvolutionHandle(ContextHandle contextHandle) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_array_schema_evolution_t*[1]; - Methods.tiledb_array_schema_evolution_alloc(contextHandle, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate ArraySchemaEvolutionHandle!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - protected override bool ReleaseHandle() - { - var p = (tiledb_array_schema_evolution_t*)handle; - Methods.tiledb_array_schema_evolution_free(&p); - SetHandle(IntPtr.Zero); - return true; - } - - // Conversions, getters, operators - public ulong Get() => (ulong)handle; - private protected void SetHandle(tiledb_array_schema_evolution_t* h) => SetHandle((IntPtr)h); - private protected ArraySchemaEvolutionHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(ArraySchemaEvolutionHandle h) => h.handle; - public static implicit operator tiledb_array_schema_evolution_t*(ArraySchemaEvolutionHandle h) => - (tiledb_array_schema_evolution_t*)h.handle; - public static implicit operator ArraySchemaEvolutionHandle(tiledb_array_schema_evolution_t* value) => - new ArraySchemaEvolutionHandle((IntPtr)value); - }//public unsafe class ArraySchemaEvolutionHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class QueryHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public QueryHandle(ContextHandle contextHandle, ArrayHandle arrayHandle, tiledb_query_type_t queryType) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_query_t*[1]; - - Methods.tiledb_query_alloc(contextHandle, arrayHandle, queryType, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_query_t*)handle; - Methods.tiledb_query_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_query_t* h) { SetHandle((IntPtr)h); } - private protected QueryHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(QueryHandle h) => h.handle; - public static implicit operator tiledb_query_t*(QueryHandle h) => (tiledb_query_t*)h.handle; - public static implicit operator QueryHandle(tiledb_query_t* value) => new QueryHandle((IntPtr)value); - }//public unsafe partial class QueryHandle - - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class QueryConditionHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public QueryConditionHandle(ContextHandle contextHandle) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_query_condition_t*[1]; - - Methods.tiledb_query_condition_alloc(contextHandle, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_query_condition_t*)handle; - Methods.tiledb_query_condition_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_query_condition_t* h) { SetHandle((IntPtr)h); } - private protected QueryConditionHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(QueryConditionHandle h) => h.handle; - public static implicit operator tiledb_query_condition_t*(QueryConditionHandle h) => (tiledb_query_condition_t*)h.handle; - public static implicit operator QueryConditionHandle(tiledb_query_condition_t* value) => new QueryConditionHandle((IntPtr)value); - }//public unsafe partial class QueryConditionHandle - - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public unsafe class GroupHandle : SafeHandle - { - // Constructor for a Handle - // - calls native allocator - // - exception on failure - public GroupHandle(ContextHandle contextHandle, sbyte* uri) : base(IntPtr.Zero, ownsHandle: true) - { - var h = stackalloc tiledb_group_t*[1]; - - Methods.tiledb_group_alloc(contextHandle, uri, h); - - if (h[0] == (void*)0) - { - throw new Exception("Failed to allocate!"); - } - SetHandle(h[0]); - } - - // Deallocator: call native free with CER guarantees from SafeHandle - override protected bool ReleaseHandle() - { - // Free the native object - var p = (tiledb_group_t*)handle; - Methods.tiledb_group_free(&p); - // Invalidate the contained pointer - SetHandle(IntPtr.Zero); - - return true; - } - - // Conversions, getters, operators - public ulong Get() { return (ulong)handle; } - private protected void SetHandle(tiledb_group_t* h) { SetHandle((IntPtr)h); } - private protected GroupHandle(IntPtr value) : base(value, ownsHandle: false) { } - public override bool IsInvalid => handle == IntPtr.Zero; - public static implicit operator IntPtr(GroupHandle h) => h.handle; - public static implicit operator tiledb_group_t*(GroupHandle h) => (tiledb_group_t*)h.handle; - public static implicit operator GroupHandle(tiledb_group_t* value) => new GroupHandle((IntPtr)value); - }//public unsafe partial class GroupHandle - -}//namespace \ No newline at end of file diff --git a/sources/TileDB.CSharp/Interop/tiledb_array_schema_evolution_t.cs b/sources/TileDB.CSharp/Interop/tiledb_array_schema_evolution_t.cs index 62f30fd0..5963a931 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_array_schema_evolution_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_array_schema_evolution_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_array_schema_evolution_t + internal partial struct tiledb_array_schema_evolution_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_array_schema_t.cs b/sources/TileDB.CSharp/Interop/tiledb_array_schema_t.cs index d6e93260..0ed17363 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_array_schema_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_array_schema_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_array_schema_t + internal partial struct tiledb_array_schema_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_array_t.cs b/sources/TileDB.CSharp/Interop/tiledb_array_t.cs index bae73dd0..f4ac4bd3 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_array_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_array_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_array_t + internal partial struct tiledb_array_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_attribute_t.cs b/sources/TileDB.CSharp/Interop/tiledb_attribute_t.cs index 1f2fd94a..8fbcb379 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_attribute_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_attribute_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_attribute_t + internal partial struct tiledb_attribute_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_config_iter_t.cs b/sources/TileDB.CSharp/Interop/tiledb_config_iter_t.cs index b3d56456..82bae077 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_config_iter_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_config_iter_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_config_iter_t + internal partial struct tiledb_config_iter_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_config_t.cs b/sources/TileDB.CSharp/Interop/tiledb_config_t.cs index 96028ce4..2aed2874 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_config_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_config_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_config_t + internal partial struct tiledb_config_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_ctx_t.cs b/sources/TileDB.CSharp/Interop/tiledb_ctx_t.cs index fa79c90d..2f85340b 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_ctx_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_ctx_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_ctx_t + internal partial struct tiledb_ctx_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_dimension_t.cs b/sources/TileDB.CSharp/Interop/tiledb_dimension_t.cs index 2e6b4810..9bd83817 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_dimension_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_dimension_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_dimension_t + internal partial struct tiledb_dimension_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_domain_t.cs b/sources/TileDB.CSharp/Interop/tiledb_domain_t.cs index 37300e31..7f452823 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_domain_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_domain_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_domain_t + internal partial struct tiledb_domain_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_filter_list_t.cs b/sources/TileDB.CSharp/Interop/tiledb_filter_list_t.cs index 2f6f888f..863bd8cf 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_filter_list_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_filter_list_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_filter_list_t + internal partial struct tiledb_filter_list_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_filter_t.cs b/sources/TileDB.CSharp/Interop/tiledb_filter_t.cs index f7d7ff77..b0e96e82 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_filter_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_filter_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_filter_t + internal partial struct tiledb_filter_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_group_t.cs b/sources/TileDB.CSharp/Interop/tiledb_group_t.cs index 70553720..e0f44057 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_group_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_group_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_group_t + internal partial struct tiledb_group_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_query_condition_t.cs b/sources/TileDB.CSharp/Interop/tiledb_query_condition_t.cs index 80146f30..75b882fb 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_query_condition_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_query_condition_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_query_condition_t + internal partial struct tiledb_query_condition_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_query_t.cs b/sources/TileDB.CSharp/Interop/tiledb_query_t.cs index d4394468..f789f361 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_query_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_query_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_query_t + internal partial struct tiledb_query_t { } } diff --git a/sources/TileDB.CSharp/Interop/tiledb_vfs_t.cs b/sources/TileDB.CSharp/Interop/tiledb_vfs_t.cs index af349707..49275ccf 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_vfs_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_vfs_t.cs @@ -1,14 +1,8 @@ // -using System.ComponentModel; -using System; -using TileDB.CSharp; - namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public partial struct tiledb_vfs_t + internal partial struct tiledb_vfs_t { } } diff --git a/sources/TileDB.CSharp/Marshalling/MarshaledString.cs b/sources/TileDB.CSharp/Marshalling/MarshaledString.cs index d30fc6fd..df6d9e0e 100644 --- a/sources/TileDB.CSharp/Marshalling/MarshaledString.cs +++ b/sources/TileDB.CSharp/Marshalling/MarshaledString.cs @@ -1,7 +1,6 @@ // 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. using System; -using System.ComponentModel; using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; @@ -9,9 +8,7 @@ namespace TileDB.Interop; -[Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] -[EditorBrowsable(EditorBrowsableState.Never)] -public unsafe struct MarshaledString : IDisposable +internal unsafe struct MarshaledString : IDisposable { public MarshaledString(string input) { diff --git a/sources/TileDB.CSharp/Marshalling/MarshaledStringOut.cs b/sources/TileDB.CSharp/Marshalling/MarshaledStringOut.cs index 8fe6e851..350e8a82 100644 --- a/sources/TileDB.CSharp/Marshalling/MarshaledStringOut.cs +++ b/sources/TileDB.CSharp/Marshalling/MarshaledStringOut.cs @@ -1,29 +1,11 @@ using System; -using System.ComponentModel; using System.Text; using TileDB.CSharp; namespace TileDB.Interop; -[Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] -[EditorBrowsable(EditorBrowsableState.Never)] -public unsafe class LibC +internal static unsafe class MarshaledStringOut { - // public struct handle_t {} - // [DllImport(LibDllImport.LibCPath)] - // public static extern void free(void* p); -} - -[Obsolete(Obsoletions.TileDBInterop2Message, DiagnosticId = Obsoletions.TileDBInterop2DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] -[EditorBrowsable(EditorBrowsableState.Never)] -public unsafe class MarshaledStringOut -{ - public sbyte* Value; - public MarshaledStringOut() - { - Value = null; - } - /// /// Encodes a read-only span of bytes into a string, using the default encoding. /// @@ -36,7 +18,7 @@ internal static string GetString(ReadOnlySpan span, DataType dataType) => DataType.StringAscii => Encoding.ASCII.GetString(span), DataType.StringUtf8 => Encoding.UTF8.GetString(span), DataType.StringUtf16 => Encoding.Unicode.GetString(span), - DataType.StringUtf32=> Encoding.UTF32.GetString(span), + DataType.StringUtf32 => Encoding.UTF32.GetString(span), _ => throw new ArgumentOutOfRangeException(nameof(dataType), dataType, "Unsupported string data type.") }; @@ -54,6 +36,4 @@ internal static unsafe string GetStringFromNullTerminated(sbyte* ptr) span = span[0..span.IndexOf((byte)0)]; return GetString(span); } - - public static implicit operator string(MarshaledStringOut s) => GetStringFromNullTerminated(s.Value); } From edd443cd055c09b12f843f76ad5f06657937d172 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Mon, 8 Jan 2024 21:24:03 +0200 Subject: [PATCH 02/10] Remove public APIs obsoleted under code TILEDB0013. --- sources/TileDB.CSharp/Array.cs | 2 +- sources/TileDB.CSharp/Dimension.cs | 4 +- sources/TileDB.CSharp/Enumeration.cs | 2 +- sources/TileDB.CSharp/Enums.cs | 66 +--------------------------- 4 files changed, 5 insertions(+), 69 deletions(-) diff --git a/sources/TileDB.CSharp/Array.cs b/sources/TileDB.CSharp/Array.cs index 4600b255..c225d203 100644 --- a/sources/TileDB.CSharp/Array.cs +++ b/sources/TileDB.CSharp/Array.cs @@ -457,7 +457,7 @@ public static void Vacuum(Context ctx, string uri, Config? config = null) { using var dim = domain.Dimension(i); var dimName = dim.Name(); - var dimType = EnumUtil.DataTypeToType(dim.Type()); + var dimType = EnumUtil.DataTypeToNumericType(dim.Type()); switch (Type.GetTypeCode(dimType)) { diff --git a/sources/TileDB.CSharp/Dimension.cs b/sources/TileDB.CSharp/Dimension.cs index 3a8a1aaa..e899118e 100644 --- a/sources/TileDB.CSharp/Dimension.cs +++ b/sources/TileDB.CSharp/Dimension.cs @@ -178,7 +178,7 @@ public T TileExtent() where T : struct public string TileExtentToStr() { var datatype = Type(); - var t = EnumUtil.DataTypeToType(datatype); + var t = EnumUtil.DataTypeToNumericType(datatype); return System.Type.GetTypeCode(t) switch { TypeCode.Int16 => Format(), @@ -201,7 +201,7 @@ public string TileExtentToStr() public string DomainToStr() { var datatype = Type(); - var t = EnumUtil.DataTypeToType(datatype); + var t = EnumUtil.DataTypeToNumericType(datatype); return System.Type.GetTypeCode(t) switch { TypeCode.Int16 => Format(), diff --git a/sources/TileDB.CSharp/Enumeration.cs b/sources/TileDB.CSharp/Enumeration.cs index 2dcd9e41..0ae1e211 100644 --- a/sources/TileDB.CSharp/Enumeration.cs +++ b/sources/TileDB.CSharp/Enumeration.cs @@ -287,7 +287,7 @@ public System.Array GetValues() return result; } - Type type = EnumUtil.DataTypeToType(datatype); + Type type = EnumUtil.DataTypeToNumericType(datatype); if (type == typeof(sbyte)) { return GetValues(dataPtr, dataSize, offsetsPtr, offsetsSize); diff --git a/sources/TileDB.CSharp/Enums.cs b/sources/TileDB.CSharp/Enums.cs index 8d032fb9..56bb723c 100644 --- a/sources/TileDB.CSharp/Enums.cs +++ b/sources/TileDB.CSharp/Enums.cs @@ -1150,8 +1150,7 @@ public static VfsMode VfsModeFromStr(string str) /// /// The type to convert. /// is unsupported. - [Obsolete(Obsoletions.DataTypeTypeConversionsMessage, DiagnosticId = Obsoletions.DataTypeTypeConversionsDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - public static DataType TypeToDataType(Type t) + internal static DataType TypeToDataType(Type t) { if (t == typeof(int)) { @@ -1208,69 +1207,6 @@ public static DataType TypeToDataType(Type t) } } - [Obsolete(Obsoletions.DataTypeTypeConversionsMessage, DiagnosticId = Obsoletions.DataTypeTypeConversionsDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - public static Type DataTypeToType(DataType datatype) - { - switch (datatype) - { - case DataType.DateTimeAttosecond: - case DataType.DateTimeDay: - case DataType.DateTimeFemtosecond: - case DataType.DateTimeHour: - case DataType.DateTimeMinute: - case DataType.DateTimeMonth: - case DataType.DateTimeMillisecond: - case DataType.DateTimeNanosecond: - case DataType.DateTimePicosecond: - case DataType.DateTimeSecond: - case DataType.DateTimeMicrosecond: - case DataType.DateTimeWeek: - case DataType.DateTimeYear: - return typeof(long); - case DataType.Float32: - return typeof(float); - case DataType.Float64: - return typeof(double); - case DataType.Int16: - return typeof(short); - case DataType.Int32: - return typeof(int); - case DataType.Int64: - return typeof(long); - case DataType.Int8: - return typeof(sbyte); - case DataType.StringAscii: - case DataType.StringUtf16: - case DataType.StringUtf32: - case DataType.StringUtf8: - return typeof(sbyte); - case DataType.TimeAttosecond: - case DataType.TimeFemtosecond: - case DataType.TimeHour: - case DataType.TimeMinute: - case DataType.TimeMillisecond: - case DataType.TimeNanosecond: - case DataType.TimePicosecond: - case DataType.TimeSecond: - case DataType.TimeMicrosecond: - return typeof(long); - case DataType.UInt16: - return typeof(ushort); - case DataType.UInt32: - return typeof(uint); - case DataType.UInt64: - return typeof(ulong); - case DataType.UInt8: - return typeof(byte); - case DataType.Blob: - return typeof(byte); - case DataType.Boolean: - return typeof(byte); - default: - return typeof(byte); - } - } - // Same with DataTypeToType, but returns the correct corresponding numeric type for strings. internal static Type DataTypeToNumericType(DataType datatype) { From 7e766c16f8a855b2993729604ba4780bb47f7f8a Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Mon, 8 Jan 2024 21:25:56 +0200 Subject: [PATCH 03/10] Remove a no longer needed workaround. --- sources/TileDB.CSharp/Array.cs | 3 --- sources/TileDB.CSharp/ArraySchema.cs | 4 ---- sources/TileDB.CSharp/ArraySchemaEvolution.cs | 1 - sources/TileDB.CSharp/Attribute.cs | 2 -- sources/TileDB.CSharp/Config.cs | 1 - sources/TileDB.CSharp/ConfigIterator.cs | 2 -- sources/TileDB.CSharp/Context.cs | 2 -- sources/TileDB.CSharp/Dimension.cs | 2 -- sources/TileDB.CSharp/Domain.cs | 4 +--- sources/TileDB.CSharp/File.cs | 1 - sources/TileDB.CSharp/Filter.cs | 1 - sources/TileDB.CSharp/FilterList.cs | 2 -- sources/TileDB.CSharp/FragmentInfo.cs | 2 -- sources/TileDB.CSharp/Group.cs | 4 +--- sources/TileDB.CSharp/Query.cs | 2 -- sources/TileDB.CSharp/QueryCondition.cs | 1 - sources/TileDB.CSharp/VFS.cs | 2 -- 17 files changed, 2 insertions(+), 34 deletions(-) diff --git a/sources/TileDB.CSharp/Array.cs b/sources/TileDB.CSharp/Array.cs index c225d203..c88e5412 100644 --- a/sources/TileDB.CSharp/Array.cs +++ b/sources/TileDB.CSharp/Array.cs @@ -5,9 +5,6 @@ using TileDB.CSharp.Marshalling; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ArrayHandle = TileDB.CSharp.Marshalling.SafeHandles.ArrayHandle; -using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/ArraySchema.cs b/sources/TileDB.CSharp/ArraySchema.cs index 1cda1b80..2e14e68c 100644 --- a/sources/TileDB.CSharp/ArraySchema.cs +++ b/sources/TileDB.CSharp/ArraySchema.cs @@ -2,10 +2,6 @@ using System.Collections.Generic; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle; -using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle; -using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle; -using AttributeHandle = TileDB.CSharp.Marshalling.SafeHandles.AttributeHandle; using TileDB.CSharp.Marshalling; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/ArraySchemaEvolution.cs b/sources/TileDB.CSharp/ArraySchemaEvolution.cs index 1892c58e..907f61e8 100644 --- a/sources/TileDB.CSharp/ArraySchemaEvolution.cs +++ b/sources/TileDB.CSharp/ArraySchemaEvolution.cs @@ -1,7 +1,6 @@ using System; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ArraySchemaEvolutionHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaEvolutionHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Attribute.cs b/sources/TileDB.CSharp/Attribute.cs index 0144fb5e..b4b71262 100644 --- a/sources/TileDB.CSharp/Attribute.cs +++ b/sources/TileDB.CSharp/Attribute.cs @@ -5,8 +5,6 @@ using TileDB.Interop; using TileDB.CSharp.Marshalling; using TileDB.CSharp.Marshalling.SafeHandles; -using AttributeHandle = TileDB.CSharp.Marshalling.SafeHandles.AttributeHandle; -using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Config.cs b/sources/TileDB.CSharp/Config.cs index 69a7a431..5b525a8e 100644 --- a/sources/TileDB.CSharp/Config.cs +++ b/sources/TileDB.CSharp/Config.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/ConfigIterator.cs b/sources/TileDB.CSharp/ConfigIterator.cs index 7bcffbd8..19f252fb 100644 --- a/sources/TileDB.CSharp/ConfigIterator.cs +++ b/sources/TileDB.CSharp/ConfigIterator.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; -using ConfigIteratorHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigIteratorHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Context.cs b/sources/TileDB.CSharp/Context.cs index 9ae07dfc..174e2e79 100644 --- a/sources/TileDB.CSharp/Context.cs +++ b/sources/TileDB.CSharp/Context.cs @@ -7,8 +7,6 @@ using System.Text; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ContextHandle = TileDB.CSharp.Marshalling.SafeHandles.ContextHandle; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Dimension.cs b/sources/TileDB.CSharp/Dimension.cs index e899118e..cdb65bb9 100644 --- a/sources/TileDB.CSharp/Dimension.cs +++ b/sources/TileDB.CSharp/Dimension.cs @@ -4,8 +4,6 @@ using TileDB.CSharp.Marshalling; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using DimensionHandle = TileDB.CSharp.Marshalling.SafeHandles.DimensionHandle; -using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Domain.cs b/sources/TileDB.CSharp/Domain.cs index e7a7d168..126f788f 100644 --- a/sources/TileDB.CSharp/Domain.cs +++ b/sources/TileDB.CSharp/Domain.cs @@ -1,9 +1,7 @@ using System; +using TileDB.CSharp.Marshalling; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle; -using DimensionHandle = TileDB.CSharp.Marshalling.SafeHandles.DimensionHandle; -using TileDB.CSharp.Marshalling; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/File.cs b/sources/TileDB.CSharp/File.cs index a5e32d96..7d1cd4ef 100644 --- a/sources/TileDB.CSharp/File.cs +++ b/sources/TileDB.CSharp/File.cs @@ -2,7 +2,6 @@ using System.ComponentModel; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Filter.cs b/sources/TileDB.CSharp/Filter.cs index 71665de3..39467c67 100644 --- a/sources/TileDB.CSharp/Filter.cs +++ b/sources/TileDB.CSharp/Filter.cs @@ -3,7 +3,6 @@ using System.Runtime.InteropServices; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using FilterHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/FilterList.cs b/sources/TileDB.CSharp/FilterList.cs index 5c8966e9..79f11f63 100644 --- a/sources/TileDB.CSharp/FilterList.cs +++ b/sources/TileDB.CSharp/FilterList.cs @@ -1,8 +1,6 @@ using System; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using FilterHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterHandle; -using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/FragmentInfo.cs b/sources/TileDB.CSharp/FragmentInfo.cs index a4d5d3cb..f68531f4 100644 --- a/sources/TileDB.CSharp/FragmentInfo.cs +++ b/sources/TileDB.CSharp/FragmentInfo.cs @@ -3,8 +3,6 @@ using TileDB.CSharp.Marshalling; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Group.cs b/sources/TileDB.CSharp/Group.cs index 674cf4f4..d425e55d 100644 --- a/sources/TileDB.CSharp/Group.cs +++ b/sources/TileDB.CSharp/Group.cs @@ -1,9 +1,7 @@ using System; +using TileDB.CSharp.Marshalling; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using GroupHandle = TileDB.CSharp.Marshalling.SafeHandles.GroupHandle; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; -using TileDB.CSharp.Marshalling; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/Query.cs b/sources/TileDB.CSharp/Query.cs index e1b78e56..85183285 100644 --- a/sources/TileDB.CSharp/Query.cs +++ b/sources/TileDB.CSharp/Query.cs @@ -5,8 +5,6 @@ using System.Runtime.InteropServices; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using QueryHandle = TileDB.CSharp.Marshalling.SafeHandles.QueryHandle; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/QueryCondition.cs b/sources/TileDB.CSharp/QueryCondition.cs index 112d2b3f..2052821b 100644 --- a/sources/TileDB.CSharp/QueryCondition.cs +++ b/sources/TileDB.CSharp/QueryCondition.cs @@ -1,7 +1,6 @@ using System; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using QueryConditionHandle = TileDB.CSharp.Marshalling.SafeHandles.QueryConditionHandle; namespace TileDB.CSharp; diff --git a/sources/TileDB.CSharp/VFS.cs b/sources/TileDB.CSharp/VFS.cs index 48dc841d..40ac7477 100644 --- a/sources/TileDB.CSharp/VFS.cs +++ b/sources/TileDB.CSharp/VFS.cs @@ -6,8 +6,6 @@ using System.Runtime.InteropServices; using TileDB.CSharp.Marshalling.SafeHandles; using TileDB.Interop; -using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle; -using VFSHandle = TileDB.CSharp.Marshalling.SafeHandles.VFSHandle; namespace TileDB.CSharp; From f5def6222b12255d7f73a21133cd52b612b203fd Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Mon, 8 Jan 2024 21:41:28 +0200 Subject: [PATCH 04/10] Add a file with package validation suppressions. --- sources/TileDB.CSharp/CompatibilitySuppressions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/TileDB.CSharp/CompatibilitySuppressions.xml b/sources/TileDB.CSharp/CompatibilitySuppressions.xml index c83410e2..67455cf8 100644 --- a/sources/TileDB.CSharp/CompatibilitySuppressions.xml +++ b/sources/TileDB.CSharp/CompatibilitySuppressions.xml @@ -1,6 +1,6 @@  - + PKV006 net5.0 From b919e6313f395af05797557c50fb7db95f0e3d0d Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Mon, 8 Jan 2024 21:42:20 +0200 Subject: [PATCH 05/10] Mark the example project as non-packable. --- examples/TileDB.CSharp.Example/TileDB.CSharp.Example.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/TileDB.CSharp.Example/TileDB.CSharp.Example.csproj b/examples/TileDB.CSharp.Example/TileDB.CSharp.Example.csproj index c93ed682..b9834352 100644 --- a/examples/TileDB.CSharp.Example/TileDB.CSharp.Example.csproj +++ b/examples/TileDB.CSharp.Example/TileDB.CSharp.Example.csproj @@ -6,6 +6,7 @@ TileDB.CSharp.Examples net8.0 true + false From 1899e2cb17aab3d77ccf1d29be1cf95db7a76e7e Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 27 May 2025 14:44:24 +0300 Subject: [PATCH 06/10] Remove public APIs obsoleted under code TILEDB0014. --- sources/TileDB.CSharp/Interop/tiledb_array_type_t.cs | 4 +--- sources/TileDB.CSharp/Interop/tiledb_datatype_t.cs | 4 +--- sources/TileDB.CSharp/Interop/tiledb_filter_type_t.cs | 4 +--- sources/TileDB.CSharp/Interop/tiledb_query_type_t.cs | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sources/TileDB.CSharp/Interop/tiledb_array_type_t.cs b/sources/TileDB.CSharp/Interop/tiledb_array_type_t.cs index a09bc4f8..d2de8ccf 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_array_type_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_array_type_t.cs @@ -6,9 +6,7 @@ namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop3Message, DiagnosticId = Obsoletions.TileDBInterop3DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public enum tiledb_array_type_t + internal enum tiledb_array_type_t { TILEDB_DENSE = 0, TILEDB_SPARSE = 1, diff --git a/sources/TileDB.CSharp/Interop/tiledb_datatype_t.cs b/sources/TileDB.CSharp/Interop/tiledb_datatype_t.cs index 8f1b1185..458e7068 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_datatype_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_datatype_t.cs @@ -6,9 +6,7 @@ namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop3Message, DiagnosticId = Obsoletions.TileDBInterop3DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public enum tiledb_datatype_t + internal enum tiledb_datatype_t { TILEDB_INT32 = 0, TILEDB_INT64 = 1, diff --git a/sources/TileDB.CSharp/Interop/tiledb_filter_type_t.cs b/sources/TileDB.CSharp/Interop/tiledb_filter_type_t.cs index 5c8f5da6..dd967012 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_filter_type_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_filter_type_t.cs @@ -6,9 +6,7 @@ namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop3Message, DiagnosticId = Obsoletions.TileDBInterop3DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public enum tiledb_filter_type_t + internal enum tiledb_filter_type_t { TILEDB_FILTER_NONE = 0, TILEDB_FILTER_GZIP = 1, diff --git a/sources/TileDB.CSharp/Interop/tiledb_query_type_t.cs b/sources/TileDB.CSharp/Interop/tiledb_query_type_t.cs index 72d4e64f..d49f36f1 100644 --- a/sources/TileDB.CSharp/Interop/tiledb_query_type_t.cs +++ b/sources/TileDB.CSharp/Interop/tiledb_query_type_t.cs @@ -6,9 +6,7 @@ namespace TileDB.Interop { - [Obsolete(Obsoletions.TileDBInterop3Message, DiagnosticId = Obsoletions.TileDBInterop3DiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [EditorBrowsable(EditorBrowsableState.Never)] - public enum tiledb_query_type_t + internal enum tiledb_query_type_t { TILEDB_READ = 0, TILEDB_WRITE = 1, From b95f9e873861cc5e4c554252cad991df1cb202e9 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 27 May 2025 14:41:58 +0300 Subject: [PATCH 07/10] Remove public APIs obsoleted under code TILEDB0015. --- sources/TileDB.CSharp/Config.cs | 15 +----------- sources/TileDB.CSharp/ConfigIterator.cs | 27 +++------------------- sources/TileDB.CSharp/TileDB.CSharp.csproj | 1 - 3 files changed, 4 insertions(+), 39 deletions(-) diff --git a/sources/TileDB.CSharp/Config.cs b/sources/TileDB.CSharp/Config.cs index 5b525a8e..f2b87308 100644 --- a/sources/TileDB.CSharp/Config.cs +++ b/sources/TileDB.CSharp/Config.cs @@ -173,15 +173,6 @@ public void SaveToFile(string filename) ErrorHandling.CheckLastError(&p_tiledb_error, status); } - /// - /// Gets a that enumerates over all options whose parameter namess start with a given prefix. - /// - /// The parameters' name's prefix. - public ConfigIterator Iterate(string prefix) - { - return new ConfigIterator(_handle, prefix); - } - /// /// Checks if two s have the same content. /// @@ -205,11 +196,7 @@ public IEnumerator> GetEnumerator() => private sealed class Enumerator(Config config, string prefix) : IEnumerator> { -#pragma warning disable TILEDB0015 // Type or member is obsolete - // We use ConfigIterator as an implementation detail. - // In the future, ConfigIterator will become internal and replace this class. private readonly ConfigIterator _iterator = new(config.Handle, prefix); -#pragma warning restore TILEDB0015 // Type or member is obsolete private readonly string _prefix = prefix; @@ -223,7 +210,7 @@ public bool MoveNext() { return false; } - _current = _iterator.HereImpl(); + _current = _iterator.Here(); _iterator.Next(); return true; } diff --git a/sources/TileDB.CSharp/ConfigIterator.cs b/sources/TileDB.CSharp/ConfigIterator.cs index 19f252fb..6aeec6fe 100644 --- a/sources/TileDB.CSharp/ConfigIterator.cs +++ b/sources/TileDB.CSharp/ConfigIterator.cs @@ -5,12 +5,10 @@ namespace TileDB.CSharp; -[Obsolete(Obsoletions.ConfigIteratorMessage, DiagnosticId = Obsoletions.ConfigIteratorDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] -public sealed unsafe class ConfigIterator : IDisposable +internal sealed unsafe class ConfigIterator : IDisposable { private readonly ConfigIteratorHandle _handle; private readonly ConfigHandle _hConfig; - private bool _disposed; internal ConfigIterator(ConfigHandle hConfig, string prefix) { @@ -20,24 +18,11 @@ internal ConfigIterator(ConfigHandle hConfig, string prefix) public void Dispose() { - Dispose(true); + _handle.Dispose(); } - private void Dispose(bool disposing) - { - if (_disposed) return; - if (disposing && (!_handle.IsInvalid)) - { - _handle.Dispose(); - } - - _disposed = true; - } - - internal ConfigIteratorHandle Handle => _handle; - // Internal overload that returns KVP to avoid the Tuple allocation. - internal KeyValuePair HereImpl() + internal KeyValuePair Here() { tiledb_error_t* p_tiledb_error; sbyte* paramPtr; @@ -55,12 +40,6 @@ internal KeyValuePair HereImpl() return new KeyValuePair(param, value); } - public Tuple Here() - { - var here = HereImpl(); - return new Tuple(here.Key, here.Value); - } - public void Next() { tiledb_error_t* p_tiledb_error; diff --git a/sources/TileDB.CSharp/TileDB.CSharp.csproj b/sources/TileDB.CSharp/TileDB.CSharp.csproj index 6078d8d5..80a66951 100644 --- a/sources/TileDB.CSharp/TileDB.CSharp.csproj +++ b/sources/TileDB.CSharp/TileDB.CSharp.csproj @@ -12,7 +12,6 @@ true true 5.16.0 - $(NoWarn);TILEDB0012;TILEDB0013;TILEDB0014 From eeb07b9c000412f64d54bf09c793a833a6a951ed Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 27 May 2025 14:42:03 +0300 Subject: [PATCH 08/10] Fix typos. --- docs/obsoletions.md | 2 +- sources/TileDB.CSharp/File.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/obsoletions.md b/docs/obsoletions.md index ff946311..ec7e8e7d 100644 --- a/docs/obsoletions.md +++ b/docs/obsoletions.md @@ -10,7 +10,7 @@ Following [the deprecation policy of TileDB Embedded][core-deprecation], obsolet |[`TILEDB0012`](#TILEDB0012) …[`TILEDB0013`](#TILEDB0013)|5.7.0|5.9.0| |[`TILEDB0014`](#TILEDB0014) …[`TILEDB0014`](#TILEDB0014)|5.8.0|5.10.0| |[`TILEDB0015`](#TILEDB0015) …[`TILEDB0015`](#TILEDB0015)|5.13.0|5.15.0| -|[`TILEDB0015`](#TILEDB0016) …[`TILEDB0015`](#TILEDB0016)|5.17.0|5.19.0| +|[`TILEDB0016`](#TILEDB0016) …[`TILEDB0016`](#TILEDB0016)|5.17.0|5.19.0| ## `TILEDB0001` - Enum value names that start with `TILEDB_` were replaced with C#-friendly names. diff --git a/sources/TileDB.CSharp/File.cs b/sources/TileDB.CSharp/File.cs index 7d1cd4ef..3184b8a0 100644 --- a/sources/TileDB.CSharp/File.cs +++ b/sources/TileDB.CSharp/File.cs @@ -5,7 +5,7 @@ namespace TileDB.CSharp; -[Obsolete(Obsoletions.FilestoreApiMessage, DiagnosticId = Obsoletions.ConfigIteratorDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] +[Obsolete(Obsoletions.FilestoreApiMessage, DiagnosticId = Obsoletions.FilestoreApiDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public sealed unsafe class File { private readonly Context _ctx; From 7a6e8c21bf0629596ea13d0e81f18135dd07c3f0 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 27 May 2025 14:46:25 +0300 Subject: [PATCH 09/10] Obsolete `FileStoreUtil`. --- sources/TileDB.CSharp/FileStoreUtil.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/TileDB.CSharp/FileStoreUtil.cs b/sources/TileDB.CSharp/FileStoreUtil.cs index 1b0666aa..7e3eccc2 100644 --- a/sources/TileDB.CSharp/FileStoreUtil.cs +++ b/sources/TileDB.CSharp/FileStoreUtil.cs @@ -6,6 +6,7 @@ namespace TileDB.CSharp; +[Obsolete(Obsoletions.FilestoreApiMessage, DiagnosticId = Obsoletions.FilestoreApiDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static class FileStoreUtil { public static void SaveFileToArray(Context ctx, string array_uri, string file) From bf8f7acd7d21e35a660acfb11f0f78e8d915b0ac Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Thu, 29 May 2025 16:38:25 +0300 Subject: [PATCH 10/10] Update a test. --- tests/TileDB.CSharp.Test/ConfigTest.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/TileDB.CSharp.Test/ConfigTest.cs b/tests/TileDB.CSharp.Test/ConfigTest.cs index 508fa144..33a401fe 100644 --- a/tests/TileDB.CSharp.Test/ConfigTest.cs +++ b/tests/TileDB.CSharp.Test/ConfigTest.cs @@ -86,9 +86,6 @@ public void ConfigIterator() { var config = new Config(); - // Iterate the configuration - var iter = config.Iterate("vfs.s3."); - foreach (var config_entry_pair in config.EnumerateOptions("vfs.s3.")) { switch (config_entry_pair.Key) @@ -193,7 +190,6 @@ public void ConfigIterator() Assert.AreEqual("true", config_entry_pair.Value); break; } - iter.Next(); } } -} \ No newline at end of file +}