Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IncludeFrameworkShims>true</IncludeFrameworkShims>
<TargetFrameworks>$(ProductTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like just whitespace change? tabs/spaces?

<IncludeFrameworkShims>true</IncludeFrameworkShims>
<TargetFrameworks>$(ProductTargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
<Summary>Provides additional features that add functionality to the Open XML SDK.</Summary>
<Description>Provides additional functionality to the Open XML SDK.</Description>
</PropertyGroup>
<PropertyGroup>
<Summary>Provides additional features that add functionality to the Open XML SDK.</Summary>
<Description>Provides additional functionality to the Open XML SDK.</Description>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml.Framework\SimpleTypes\HexStringFactory.cs" Link="HexStringFactory.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml.Framework\SimpleTypes\HexStringFactory.cs" Link="HexStringFactory.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DocumentFormat.OpenXml\DocumentFormat.OpenXml.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DocumentFormat.OpenXml\DocumentFormat.OpenXml.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
19 changes: 17 additions & 2 deletions src/DocumentFormat.OpenXml.Framework/Packaging/OpenXmlPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,23 @@ internal void Load(OpenXmlPackage? openXmlPackage, OpenXmlPart? parent, Uri uriT

SetPackage(openXmlPackage, parent);

// TODO: should we delay load?
var part = _openXmlPackage.Features.GetRequired<IPackageFeature>().Package.GetPart(uriTarget);
IPackagePart? part = null;
try
{
// TODO: should we delay load?
part = _openXmlPackage.Features.GetRequired<IPackageFeature>().Package.GetPart(uriTarget);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make the Getpart return null when there's this failure? Then we can just check for a null

}
catch (InvalidOperationException ex)
{
var errorMessage = SR.Format(
ExceptionMessages.SpecifiedPartNotFound,
uriTarget.OriginalString, ex.Message);
throw new InvalidOperationException(errorMessage);
}
catch (Exception)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't necessary

{
throw;
}

Features.Set<IPackagePartFeature>(new PackagePartFeature(part));

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,9 @@
<data name="EncryptedPackageNotSupported" xml:space="preserve">
<value>Encrypted packages are not supported.</value>
</data>
<data name="SpecifiedPartNotFound" xml:space="preserve">
<value> Part: {0} doesn't exist in the package.

Original Message:{1}</value>
</data>
</root>
Loading