Closed ChristopherL-STCU closed 3 years ago
Hey there @ChristopherL-STCU thank you for writing in with this question. I am glad to see that I am not the only one with struggles around Azure Functions. 😁 In fact, I encountered them so much I ended up using WebJobs as much as I could in its stead.
In any case, are you able to confirm if this occurs if you remove all ExtendedXmlSerializer code? If so, I would start putting Information outputs (logging) around the lines to see where exactly this is failing. I am unaware of what fusion.dll
is, but apparently, it has some history with this error.
Thanks @Mike-E-angelo. The error only occurs when I add ExtendedXmlSerializer
. I noticed the GitHub issue you referenced when I was trying to figure it out as well. I also see fusion.dll
is used by ExtendedXmlSerializer
. I wonder if fusion.dll
is not available from within the Azure Function context. Azure Functions are particular. I don't know much about fusion.dll
either and so I don't know if this should work within an Azure Function or if a different approach is needed for Azure Functions. It may not be worthwhile to try to figure all of this out, but I thought I'd ask the question here.
Branch issues/fix/i543 created!
WOW... first off, thank you for having more interest in this area than I do, @ChristopherL-STCU. 😆 I appreciate you digging through and finding the culprit. I was pretty amazed that we indeed had a dependency on this dll, and even more amazed that it somehow works cross-platform.
I believe that was added eons ago before there was a netstandard2.0
call to Assembly.Load/LoadWithPartialName
.
I have updated the usage of this, and a build is here for you to check out: https://github.com/ExtendedXmlSerializer/home/pull/544#issuecomment-909639753
Please let me know if you run into any further issues and I will take a look into it for you. 👍
Doh I may have mispoken here, @ChristopherL-STCU ... the logic appears to be related to #366 and is intended to retrieve from the GAC.
Can you confirm that you are using Azure Functions in .NETCore or .NET Framework? And which version?
Hi @ChristopherL-STCU if you are using .NET Core please try this build out: https://github.com/ExtendedXmlSerializer/home/pull/544#issuecomment-909665170
If you are running .NET Framework then I am out of ideas. That fusion.dll
is a very native assembly and should be located for .NET Framework scenarios. I cannot remove it as it is necessary for scenarios such as #366 where the GAC has an assembly that is not found on local disk. As such, I have basically modified the build so that the GAC-accessing logic is only emitted for the .NET Framework libraries. Hopefully that addresses the issue here, but who knows with Azure Functions. 😓
Wow! Thanks for making the change so quickly!
It is using .Net Core, <TargetFramework>netcoreapp3.1</TargetFramework>
. I grabbed the preview version you just built but I'm still experiencing the error. 😕 I decompiled the assembly and I do have the change you made. I'm not sure what's up. I'll continue to experiment and report back if I make any progress.
Whoa so you are saying you can verify that the link to fusion.dll
is removed and you're still getting a fusion.dll
error? That is wild. It must be a caching issue. Does this occur locally or deployed?
The problem appears to be because there is a hyphen in my project name, and so there is a hyphen in the generated assembly name. The ExtendedXmlSerializer assembly parser does not include hyphen as a valid character when parsing the assembly name. This mean when ExtendedXmlSerializer tries to load the assembly it's only using a partial name of the assemble, and therefore cannot find it. This causes ExtendedXmlSerializer to fallback to the old assembly load method which uses fusion.dll
, hence the error message I'm experiencing.
Excellent work in tracking this down, @ChristopherL-STCU. I am going to undo the work yesterday as I absolutely detest compiler definitions which is what I was using to make that work.
(That stated if we still need to do this for whatever reason I can re-introduce it)
Please try this build which allows hyphens as allowed characters in assembly names and let me know if it treats you any better: https://github.com/ExtendedXmlSerializer/home/pull/544#issuecomment-910798800
Yes, that works for me! 🎉 Thanks! ❤️
Awesome! Release days are typically on Tuesdays so I will get this launched out next Tuesday. Please feel free to use the preview build until then and I will update here once it's deployed to NuGet. 👍
This has been deployed to NuGet: https://www.nuget.org/packages/ExtendedXmlSerializer/
Please do let me know if you encounter any additional/further issues and I will look into them for you.
Closing this for now.
An extensible Xml Serializer for .NET that builds on the functionality of the classic XmlSerializer with a powerful and robust extension model.
Hey there! I'm having the same issue with .NET 5 and EXS 3.7.5 🤔
"Unable to load DLL 'fusion.dll' or one of its dependencies: Cannot find the module specified. (0x8007007E)"
at ExtendedXmlSerializer.ReflectionModel.AssemblyPath.CreateAssemblyCache(IAssemblyCache& ppAsmCache, Int32 reserved) at ExtendedXmlSerializer.ReflectionModel.AssemblyPath.Get(String parameter) at ExtendedXmlSerializer.ReflectionModel.AssemblyLoader.Get(String parameter) at ExtendedXmlSerializer.ContentModel.Reflection.PartitionedTypeCandidates.Create(IIdentity parameter) at ExtendedXmlSerializer.Core.Sources.StructureCacheBase
2.CreateStructure(TKey parameter) at System.Runtime.CompilerServices.ConditionalWeakTable
2.GetValueLocked(TKey key, CreateValueCallback createValueCallback) at System.Runtime.CompilerServices.ConditionalWeakTable2.GetValue(TKey key, CreateValueCallback createValueCallback) at ExtendedXmlSerializer.Core.Sources.StructureCacheBase
2.Get(TKey key) at ExtendedXmlSerializer.ContentModel.Reflection.TypeCandidates.Get(IIdentity parameter) at ExtendedXmlSerializer.ContentModel.Reflection.Types.Create(IIdentity parameter) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func
2 valueFactory) at ExtendedXmlSerializer.Core.Sources.CacheBase`2.Get(TKey key) at ExtendedXmlSerializer.ContentModel.Reflection.Classification.Get(IFormatReader parameter) at ExtendedXmlSerializer.ContentModel.Extensions.GetClassification(IClassification this, IFormatReader parameter, TypeInfo defaultValue) at ExtendedXmlSerializer.ExtensionModel.Xml.Read.Get(XmlReader parameter) at ExtendedXmlSerializer.ExtensionModel.Xml.Serializer.Deserialize(XmlReader reader) at ExtendedXmlSerializer.ExtensionModel.Xml.ExtendedXmlSerializer.Deserialize(XmlReader reader) at ExtendedXmlSerializer.ExtensionMethodsForSerialization.Deserialize[T](IExtendedXmlSerializer this, XmlReaderSettings settings, Stream stream) at ExtendedXmlSerializer.ExtensionMethodsForSerialization.Deserialize[T](IExtendedXmlSerializer this, XmlReaderSettings settings, String data) at ExtendedXmlSerializer.ExtensionMethodsForSerialization.Deserialize[T](IExtendedXmlSerializer this, String data) at Deployer.Library.XmlDeploymentReader.Read(String xmlString) in F:\Repos\Deployer\Deployer.Library\XmlDeploymentReader.cs:line 21
This is a screenshot of my solution:
Also, these are the assemblies in my output folder:
"F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Desktop.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.DesktopRuntime.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Diagnostics.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Dialogs.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.FreeDesktop.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Input.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Interactivity.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Layout.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Markup.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Markup.Xaml.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.MicroCom.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.OpenGL.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.ReactiveUI.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Remote.Protocol.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Skia.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Styling.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Themes.Default.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Themes.Fluent.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Visuals.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Win32.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.X11.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Native.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ExtendedXmlSerializer.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\System.IO.Abstractions.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ReactiveUI.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Splat.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\DynamicData.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\System.Reactive.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\LightInject.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win7-x86\native\av_libglesv2.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win7-x64\native\av_libglesv2.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win-arm64\native\av_libglesv2.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win-x64\native\libSkiaSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\SkiaSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win-arm64\native\libSkiaSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win-x86\native\libSkiaSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\HarfBuzzSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win-arm64\native\libHarfBuzzSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win-x64\native\libHarfBuzzSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win-x86\native\libHarfBuzzSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Tmds.DBus.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Sprache.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\NReco.LambdaParser.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Octokit.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\System.Interactive.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Microsoft.CodeAnalysis.CSharp.Scripting.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\cs\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\de\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\es\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\fr\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\it\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ja\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ko\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pl\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pt-BR\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ru\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\tr\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hans\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hant\Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pt-BR\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ru\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\tr\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hans\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hant\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Microsoft.CodeAnalysis.Scripting.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\cs\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\de\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\es\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\fr\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\it\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ja\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ko\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pl\Microsoft.CodeAnalysis.Scripting.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Microsoft.CodeAnalysis.CSharp.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\cs\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\de\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\es\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\fr\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\it\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ja\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ko\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pl\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pt-BR\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ru\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\tr\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hans\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hant\Microsoft.CodeAnalysis.CSharp.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Microsoft.CodeAnalysis.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\cs\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\de\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\es\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\fr\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\it\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ja\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ko\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pl\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\pt-BR\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ru\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\tr\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hans\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\zh-Hant\Microsoft.CodeAnalysis.resources.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\unix\lib\netcoreapp2.0\System.Drawing.Common.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win\lib\netcoreapp2.0\System.Drawing.Common.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\System.Drawing.Common.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Microsoft.Win32.SystemEvents.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\runtimes\win\lib\netcoreapp2.0\Microsoft.Win32.SystemEvents.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\JetBrains.Annotations.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Deployer.Gui.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\ref\Deployer.Gui.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Deployer.Library.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Animation.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Base.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Controls.DataGrid.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.Controls.dll" "F:\Repos\Deployer\Deployer.Gui\bin\Debug\net5.0\Avalonia.DesignerSupport.dll"
Doh sorry to hear this @SuperJMN and thank you for reporting it. Can you say if this is something new for your codebase? That is, did it work with a previous version of ExtendedXmlSerializer?
No problem! It's a new codebase (new project). I could test anything you may need. The serializer is created like this, just in case it's useful:
NOTE: 3.7.4 doesn't work, either.
I may have to fallback to LoadWithPartialName
. Just for kicks @SuperJMN, are you able to try out this build?
https://github.com/ExtendedXmlSerializer/home/pull/544#issuecomment-909639753
It has LoadWithPartialName
for non-.NETFramework builds.
Ouch. I've tried every package in that thread, but no dice.
When I try using this in an Azure Function I receive the error:
Here's my sample code:
Is it possible for me to configure
ExtendedXmlSerializer
to be used with Azure Functions or is it possible for the library to be updated to be usable in an Azure Function?