Skip to content

Commit 535a5ac

Browse files
committed
Add cross-platform import test project runnable on Linux
CADability.ImportTests targets net8.0 (no Windows suffix) and references only CADability.csproj — no WinForms or OpenGL dependency — so all five DXF import regression tests can run on Linux CI without the Microsoft.WindowsDesktop.App runtime. Also broadens the malformed-OBJECTS-section fallback catch from DxfException to any Exception, since ACadSharp raises a NullReferenceException (not DxfException) for a truncated OBJECTS section. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2777c8e commit 535a5ac

5 files changed

Lines changed: 3849 additions & 3 deletions

File tree

CADability/ImportDxf.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ public Import(string fileName)
4242
{
4343
doc = new DxfReader(stream).Read();
4444
}
45-
catch (ACadSharp.Exceptions.DxfException)
45+
catch (Exception)
4646
{
4747
// The OBJECTS section is the last DXF section and contains non-geometric
4848
// data (dictionaries, layouts, xrecords). Geometry lives in HEADERS,
4949
// TABLES, BLOCKS, and ENTITIES — all read before OBJECTS.
50-
// When OBJECTS is malformed we fall back to a read that stops there,
51-
// so that valid geometry is still imported.
50+
// When OBJECTS is malformed (DxfException, NullReferenceException, etc.)
51+
// we fall back to a read that stops before it, so geometry still imports.
5252
doc = ReadWithoutObjectsSection(fileName);
5353
if (doc == null) throw; // OBJECTS was not the problem — re-throw
5454
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<IsPackable>false</IsPackable>
7+
<Platforms>AnyCPU;x64</Platforms>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<None Remove="Files\**\*.*" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<Content Include="Files\**\*.*">
16+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17+
</Content>
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
22+
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
23+
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
24+
<PackageReference Include="coverlet.collector" Version="3.1.2" />
25+
<PackageReference Include="JunitXml.TestLogger" Version="3.0.114" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<ProjectReference Include="..\..\CADability\CADability.csproj" />
30+
</ItemGroup>
31+
32+
</Project>

0 commit comments

Comments
 (0)