Open Numpsy opened 3 months ago
Hi @Numpsy , honestly speaking I can't actually remember the original thinking that pushed me to use this syntax to create arrays... Have you checked Microsoft documentation for some subtle difference? I think that it should work. Stack Overflow address exactly this point here
I'm not aware of any differences in the date the produce (e.g. whether they differ in how the data is initialized etc). I can't say offhand if there might have been any difference in some older .NET Version.
@ironfede Can you please merge it? I checked with AOT analyzers turned on that this is the only code flagged as not compatible.
Here's a diff to run the build as net8.0
with the analyzers turned on:
--- a/sources/OpenMcdf/OpenMcdf.csproj
+++ b/sources/OpenMcdf/OpenMcdf.csproj
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>netstandard2.0;net40</TargetFrameworks>
+ <TargetFrameworks>netstandard2.0;net40;net80</TargetFrameworks>^M
<Configurations>Debug;Release</Configurations>
<SignAssembly>true</SignAssembly>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
@@ -18,6 +18,7 @@
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
+ <IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>^M
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
…yte arrays?
I tried building an application that uses OpenMcdf as NativeAOT (.NET 8.0) and got this warning from the compiler:
I guess the code for byte arrays should always exist given they're used elsewhere, but - I'm not sure if there is a need to use Array.CreateInstance rather than just
new[]
anyway?