Resolve UnmanagedArray<T> obsolescence warnings
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
While generating documentation using docfx, I encountered 14 warnings related to the use of UnmanagedArray<T>, which has been marked as obsolete. The recommended approach is to obtain Memory<T> using GC.Allocate*Array or through a Stride-specific allocator mechanism. Addressing these warnings will enhance our codebase's cleanliness and maintainability. Below are examples of the warnings:
1. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Audio\CompressedSoundSource.cs(20,24): warning CS0618: 'UnmanagedArray<short>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
2. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\IHeightStickArraySource.cs(26,24): warning CS0618: 'UnmanagedArray<T>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
3. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\HeightStickArraySourceFromHeightmap.cs(34,31): warning CS0618: 'UnmanagedArray<T>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
4. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\ByteHeightStickArraySource.cs(45,31): warning CS0618: 'UnmanagedArray<T>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
5. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\Shapes\HeightfieldColliderShape.cs(129,16): warning CS0618: 'UnmanagedArray<short>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
6. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\Shapes\HeightfieldColliderShape.cs(131,16): warning CS0618: 'UnmanagedArray<byte>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
7. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\Shapes\HeightfieldColliderShape.cs(133,16): warning CS0618: 'UnmanagedArray<float>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
8. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\ShortHeightStickArraySource.cs(45,31): warning CS0618: 'UnmanagedArray<T>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
9. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\Shapes\HeightfieldColliderShape.cs(42,86): warning CS0618: 'UnmanagedArray<short>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
10. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\Shapes\HeightfieldColliderShape.cs(47,86): warning CS0618: 'UnmanagedArray<byte>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
11. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\Shapes\HeightfieldColliderShape.cs(52,86): warning CS0618: 'UnmanagedArray<float>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
12. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\FloatHeightStickArraySource.cs(35,31): warning CS0618: 'UnmanagedArray<T>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
13. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\Data\HeightfieldColliderShapeDesc.cs(81,24): warning CS0618: 'UnmanagedArray<T>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
14. warning: D:\Projects\GitHub\stride\sources\engine\Stride.Physics\UnmanagedArrayExtensions.cs(18,41): warning CS0618: 'UnmanagedArray<T>' is obsolete: 'Obtain Memory<T> using GC.Allocate*Array or a Stride-specific allocator mechanism.'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the documentation generation with docfx and reviewing UnmanagedArrayExtensions.cs alongside the listed audio and physics call sites. Trace how each UnmanagedArray is allocated and apply the recommended Memory or Stride-specific allocator approach consistently; done means the 14 CS0618 warnings no longer appear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100