Problems Migrating to .net 6

246 views
Skip to first unread message

Glayson Patricio

unread,
Mar 15, 2022, 3:47:10 PM3/15/22
to Excel-DNA
I am having several problems migrating to the new version 1.6.0-preview3
Specially when i add some of my other projects to the addin as dependencies.

As an example, i posted the initialization errors below:

Initialization [Warning] Assembly SYSTEM.SECURITY.CRYPTOGRAPHY.PRIMITIVES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.SECURITY.CRYPTOGRAPHY.ALGORITHMS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.WINDOWS.FORMS.PRIMITIVES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.COMPONENTMODEL.PRIMITIVES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.THREADING.TASKS.PARALLEL could not be loaded from resources.
Registration [Error] Repeated function name: 'ExecelDtToCsDayNumber' - previous registration will be overwritten.
Initialization [Warning] Assembly SYSTEM.RUNTIME could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.RUNTIME could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.RUNTIME could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.WINDOWS.FORMS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.LINQ could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.COLLECTIONS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.LINQ.EXPRESSIONS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.DIAGNOSTICS.TRACESOURCE could not be loaded from resources.
Initialization [Warning] Assembly MICROSOFT.WIN32.REGISTRY could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.COLLECTIONS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.TEXT.REGULAREXPRESSIONS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.WINDOWS.FORMS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.THREADING could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.THREADING.THREAD could not be loaded from resources.
Initialization [Warning] Assembly WINDOWSBASE could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.WINDOWS.FORMS.PRIMITIVES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.DRAWING.PRIMITIVES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.COLLECTIONS.CONCURRENT could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.DRAWING.COMMON could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.COMPONENTMODEL.TYPECONVERTER could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.RUNTIME.INTEROPSERVICES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.DIAGNOSTICS.PROCESS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.COLLECTIONS.NONGENERIC could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.THREADING could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.LINQ could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.DRAWING.PRIMITIVES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.DRAWING.COMMON could not be loaded from resources.
Initialization [Warning] Assembly MICROSOFT.WIN32.PRIMITIVES could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.DIAGNOSTICS.PROCESS could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.LINQ.EXPRESSIONS could not be loaded from resources.
Initialization [Warning] Assembly MICROSOFT.CSHARP could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.RUNTIME could not be loaded from resources.
Initialization [Warning] Assembly SYSTEM.RUNTIME could not be loaded from resources.

Govert, is there some light in the end of this tunnel ??
i was waiting for this release for more than a year

Govert van Drimmelen

unread,
Mar 15, 2022, 4:43:11 PM3/15/22
to Excel-DNA
Hi Glayson,

I think it will still be a while before the .NET 6 support is stable.
I'm glad we have something to test now and can start dealing with the remaining issues.
Thank you for trying it out.

You diagnostic windows is showing because of the one error:
Registration [Error] Repeated function name: 'ExecelDtToCsDayNumber' - previous registration will be overwritten.

This function is likely a "public static" function that appears in more than one of your types - maybe you can check.
Without this error, the diagnostic window would not show if there are only warnings logged.

The warnings arise because we had to re-write the assembly loading code for .NET 6, and the sequence in which assemblies are requested is different.
I have not yet been able to see when the warnings can be safely suppressed under the .NET 6 case, so left them in for now.

Apart from cluttering the diagnostic window, they should have no other impact.
So despite the diagnostic window and the error and warning you show, the add-in should be working.

If you have other problems, please report these too.
The .NET 6 stuff has not been tested much - I don't use it myself and many other users are quite cautious about making the move.
So I appreciate any brave pioneers willing to try it out and report where things are broken, or still a bit rough.

-Govert

Glayson Patricio

unread,
Mar 16, 2022, 2:54:18 PM3/16/22
to Excel-DNA
Hi Govert,

Thank you very much for your reply!


About the "Registration [Error] Repeated function name: 'ExecelDtToCsDayNumber' - previous registration will be overwritten."

I have two overloads of tha same static function in the same static class like below:

[ComVisible(false)]
public static class Utility
{
    public static DateOnly ExecelDtToCsDateOnly(this int x) => DateOnly.FromDayNumber(x + _excelDtToCsIntDifference);

    public static DateOnly ExecelDtToCsDateOnly(this double x) => DateOnly.FromDayNumber((int)x + _excelDtToCsIntDifference);
}

But, i believed since the [ComVisible(false)] attribute was added to the class, no method would be Registered.


About testing excel dna in .net6, you can count on me!
(I alread moved all my code ... there is no comming back)


By the way, the youtube video series that you recorded some while ago was very good!

Thanks,

Glayson

Govert van Drimmelen

unread,
Mar 16, 2022, 2:58:27 PM3/16/22
to exce...@googlegroups.com

Hi Glayson,

 

To determine which functions to register, Excel-DNA does not look at the ComVisible attribute (these functions are registered without any COM involved).

You can set up the property in the .dna file –

   <ExternalLibrary ………    ExplictiExports='true' />

 

Then only functions with an [ExcelFunction] attribute will be registered.

 

I look forward to your .NET 6 feedback.

 

-Govert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/a5e58589-e3d4-4d82-ab7b-eddfb69d2ed9n%40googlegroups.com.

Glayson Patricio

unread,
Mar 16, 2022, 5:34:19 PM3/16/22
to Excel-DNA
Hi Govert,

I was not using the .Dna file.
After Adding a .dna file things seems to be working fine.

But i could not find Properties for those .dna attributes below in the link recomended in you article about .net6
"""  ExplicitExports="true", ExplicitRegistration="true", ComServer="true"  ""

Thanks,

Glayson.
Reply all
Reply to author
Forward
0 new messages