1
Document Ultimate on DotNet 5
Question asked by Bob Smith - 10/23/2020 at 2:36 AM
Answered
Has anybody managed to get Doc Ultimate working on the latest preview release of dotnet 5?

I have installed all the appropriate dependencies with their latest 5.rc2 versions but as soon as I install doc ultimate the app fails with multiple dependencies unloadable. (for example NS Json 12.0.0.0, ZipEngine 2.0.0.0)


5 Replies

Reply to Thread
1
Cem Alacayir Replied
Employee Post
Is it a web application? If so ensure you added services.AddGleamTech() and app.UseGleamTech() calls to correct places as described here:

Also in some cases, you may need to call GleamTechConfiguration.EnsureAssemblies method.
Version 5.2.0 - January 9, 2020
  • Added: New GleamTechConfiguration.EnsureAssemblies method which ensures GleamTech's assemblies are loaded and initialized.You may need to call this method in entry point/startup of your application, if you receive "Could not load file or assembly ..." errors.

    Some DLLs are embedded inside GleamTech's DLLs and they are resolved automatically when they are requested howeverinternal AssemblyResolver should be initialized first and internal AssemblyResolver of each GleamTech DLL can be initializedonly when a type inside that DLL is accessed first. So in some cases, even a GleamTech DLL is loaded, its AssemblyResolvermay not be initialized yet (because none of its types is accessed yet). You can observe this behaviour if your applicationcalls some methods which scans assemblies for reflection purpose (reflection-only type access does not trigger DLL's module initializer),for example ASP.NET Core's endpoints.MapControllers method and SimpleInjector's RegisterMvcControllers method.So to prevent errors on those methods, you can call this method before such methods.

    Note that you should not need to call this method usually for web applications, because it is handled automaticallyas we can know when the application is started by hooking up (automatically in ASP.NET Classic and when you call AddGleamTech andUseGleamTech methods in ASP.NET Core).

0
Bob Smith Replied
Hi Cem,

Thank you for the above, much appreciated - makes things a lot clearer.
Upon a good old fashioned clean, restart, rebuild the dependency issues have cleared themselves.

However there is definitely something different between dotnet 3.1 / dotnet 5 and the gleamtech reflection mechanism.
I have just started two clean projects up, the 3.1 works exactly as expected - ie loads no problems once the services.AddGleamTech(); and app.UseGleamTech(); are added, however dotnet 5 falls over on reflections as below.
These are both new, clean ASP.NET Core Web Apps, with doc ultimate and gleamtech common installed via NuGet, same changes to Startup.cs

Errors in dotNet 5:
(triggered in endpoints.MapControllerRoute)

An error occurred while starting the application.

MissingMethodException: Method not found: 'GleamTech.Reflection.IConstructorInvoker GleamTech.Reflection.IFastReflectionFactory`2.Create(System.Reflection.ConstructorInfo)'.

Unknown location

MissingMethodException: Method not found: 'GleamTech.Reflection.IFieldAccessor GleamTech.Reflection.IFastReflectionFactory`2.Create(System.Reflection.FieldInfo)'.

Unknown location

ReflectionTypeLoadException: Unable to load one or more of the requested types.
Method not found: 'GleamTech.Reflection.IConstructorInvoker GleamTech.Reflection.IFastReflectionFactory`2.Create(System.Reflection.ConstructorInfo)'.
Method not found: 'GleamTech.Reflection.IFieldAccessor GleamTech.Reflection.IFastReflectionFactory`2.Create(System.Reflection.FieldInfo)'.

System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)

Loader Exceptions:

  • Method not found: 'GleamTech.Reflection.IConstructorInvoker GleamTech.Reflection.IFastReflectionFactory`2.Create(System.Reflection.ConstructorInfo)'.
  • Method not found: 'GleamTech.Reflection.IFieldAccessor GleamTech.Reflection.IFastReflectionFactory`2.Create(System.Reflection.FieldInfo)'.
  • MissingMethodException: Method not found: 'GleamTech.Reflection.IConstructorInvoker GleamTech.Reflection.IFastReflectionFactory`2.Create(System.Reflection.ConstructorInfo)'.


0
Cem Alacayir Replied
Employee Post
Well DotNet 5 is still release candidate and we never announced we started supporting DotNet 5 yet.
In the past, we had to fix problems for .NET Core 2.1, .NET Core 2.2 and .NET Core 3.0 when first released because there were always some small breaking changes introduced by DotNet team.

We will start examining DotNet 5 soon, in the meantime you can use the latest RTM version .NET Core 3.1.
0
Bob Smith Replied
Hi Cem,

That's fine, fully understood.  As long as I know its not me doing something stupid!
Thanks again


0
Cem Alacayir Replied
Employee Post Marked As Answer
FYI,
.NET 5.0 is RTM as of November 10, 2020 and now we support it in latest Version 5.8.0 - November 17, 2020:

  • Added: .NET 5.0 support:

    • AspNetCoreSession will use JsonConvert instead of BinaryFormatter.
      BinaryFormatter serialization methods are obsolete and prohibited in ASP.NET Core 5.

    • Obfuscation caused problems in .NET 5 which seems more sensitive about reflection metadata.
      For example, ASP.NET Core 5.0 throws MissingMethodException -> ReflectionTypeLoadException when Assembly.DefinedTypes
      is called e.g. by endpoints.MapRazorPages() or endpoints.MapControllerRoute().

Reply to Thread