Docx2Src / Serialize.OpenXml.CodeGen

.NET assembly class responsible for converting OpenXml based documents into corrisponding dotnet code
MIT License
39 stars 6 forks source link

AmbiguousMatchException with PresentationDocument #2

Closed stevenmoberg closed 3 years ago

stevenmoberg commented 3 years ago

Hello, testing with a very simple PPTX and getting a AmbiguousMatchExpression exception with the call to GenerateSourceCode()

at System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)   at System.Type.GetMethod(String name)   at Serialize.OpenXml.CodeGen.OpenXmlPartExtensions.BuildEntryMethodCodeStatements(IdPartPair part, NamespaceAliasOptions opts, IDictionary2 typeCounts, ISet1 namespaces, OpenXmlPartBluePrintCollection blueprints, KeyValuePair2 rootVar)   at Serialize.OpenXml.CodeGen.OpenXmlPartExtensions.BuildEntryMethodCodeStatements(IdPartPair part, NamespaceAliasOptions opts, IDictionary2 typeCounts, ISet1 namespaces, OpenXmlPartBluePrintCollection blueprints, KeyValuePair2 rootVar)   at Serialize.OpenXml.CodeGen.OpenXmlPackageExtensions.GenerateSourceCode(OpenXmlPackage pkg, NamespaceAliasOptions opts)   at Serialize.OpenXml.CodeGen.OpenXmlPackageExtensions.GenerateSourceCode(OpenXmlPackage pkg)

Is this is known issue or would it be related to running in LinqPad?

rmboggs commented 3 years ago

Hi, sorry for the delay.

This shouldn't be related to linqpad.

Looking at the error message. Looks like the issue is related to locating the custom addnewpart method of the current part.

Can you share the file in question so i can debug and see what I can do? Also, are you using the latest source or what is in nuget today? There may be a possibility that i haven't pushed this fix to nuget yet.

stevenmoberg commented 3 years ago

samplepptx.pptx

Here is a very simply pptx I got off the internet that has the same ambiguous exception I could not find it on nuget so I'm using the v0.2.1-alpha from github release link https://github.com/rmboggs/Serialize.OpenXml.CodeGen/releases

rmboggs commented 3 years ago

Ok, the most current release is 0.3.2-alpha here and in nuget. You may have not seen it in nuget because it is still considered a prerelease. Nuget details

Also, Looking at the project changelog, it looks like I fixed an ambiguous exception issue with the 0.3.0-alpha release. I'm going to make sure that the latest release is available here (looks like I haven't updated github in awhile, my fault). Can you check your office document file against the 0.3.2-alpha release and see if the exception still occurs?

rmboggs commented 3 years ago

This release - v0.3.2-alpha should fix this issue. Please let me know what you find.

rmboggs commented 3 years ago

I can confirm that the AmbiguousMatchException does not occur with the latest version, 0.3.2-alpha, using the referenced file in this issue. I will close this issue later today unless there are any further followups.

rmboggs commented 3 years ago

Closing issue because fix has already been applied to main branch.

stevenmoberg commented 3 years ago

yes that fixed the issue. I was trying to make sense of what it generated and forgot to reply, sorry