ILMerge fails to properly merge WpfMath
See original GitHub issueRepository https://github.com/davidagross/ILMerge-vs-WpfMath provides a MWE of this error.
Basically, when WpfMath.dll
isn’t next to the merged, standalone executable, the render fails:
System.TypeInitializationException: The type initializer for 'WpfMath.DefaultTexFont' threw an exception. ---> System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo)
at MS.Internal.Text.TextInterface.Native.Util.ConvertHresultToException(Int32 hr)
at MS.Internal.Text.TextInterface.Factory.CreateFontFace(Uri filePathUri, UInt32 faceIndex, FontSimulations fontSimulationFlags)
at System.Windows.Media.GlyphTypeface.Initialize(Uri typefaceSource, StyleSimulations styleSimulations)
at WpfMath.DefaultTexFontParser.CreateFont(String name)
at WpfMath.DefaultTexFontParser.GetFontDescriptions()
at WpfMath.DefaultTexFont..cctor()
--- End of inner exception stack trace ---
at WpfMath.DefaultTexFont..ctor(Double size)
at WpfMath.TexFormula.GetRenderer(TexStyle style, Double scale, String systemTextFontName)
at WpfMath.Extensions.RenderToPng(TexFormula texForm, Double scale, Double x, Double y, String systemTextFontName)
at ILMerge_vs_WpfMath.Renderer.DisplayEquation()
at ILMerge_vs_WpfMath.Renderer..ctor()
indicating that the merge was not successfull. This is also tracked in https://github.com/dotnet/ILMerge/issues/70.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
ILMerge fails to properly merge WpfMath · Issue #202
Basically, when WpfMath.dll isn't next to the merged, standalone executable, ... ILMerge fails to properly merge WpfMath #202.
Read more >ILMerge fails to merge: The assembly 'xxx' was not ...
A common problem is that after merging some assemblies, you get an error message stating that an input assembly was not merged in...
Read more >error merging with ILmerge
Hello i have created a simple tool a console application to read the appointments from an scheduler and send it a report, i...
Read more >ILMerge WPF Controls
ILMerge is not able to merge WPF assemblies. They contain resources with encoded assembly identities. ILMerge is unable to deserialize the ...
Read more >ILMerge for Infragistics 13.2 assemblies fails
Do you want to use the /alllowDup option? An exception occurred during merging: ILMerge.Merge: ERROR!!: Duplicate type 'Infragistics.Win.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately, not yet; sorry for the pause.
I’ll try to make it till 2020-01-09.
I’ve taken a look at the issue. The following patch doesn’t solve the problem, even if it was supposed to:
Even when I’m trying to use a correct assembly name (according to the pack URIs documentation), the following exception gets thrown (note it’s not “file not found” anymore, but something about “I/O Error occurred”):
Here’s the resource section of the binary after ILMerge:
It looks like
WpfMath.g.resources
should be renamed toILMerge-vs-WpfMath.Standalone.g.resources
or something like that, but I haven’t tried that.From this investigation, it’s clear that we cannot do anything about the issue in the WPF-Math code currently.
If you’ll ever found a way to rename the resource using ILMerge, then please inform me, and I’ll try if the patch helps the resulting application to work. If it is, then we’ll merge it.
I’ll not merge that patch to the main code base for now, because we’ve no proof that it’ll work even after some resource-related workarounds with ILMerge.
For now, I’ll close the issue as (supposedly) non-actional from our side. Feel free to comment though, if it becomes actionable then I’ll gladly reopen and fix it.