-
Notifications
You must be signed in to change notification settings - Fork 573
Improves Exception Message to show what part is missing. - #1971 #1974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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> | ||
| <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> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
||
| { | ||
| throw; | ||
| } | ||
|
|
||
| Features.Set<IPackagePartFeature>(new PackagePartFeature(part)); | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
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?