Debugging Not Working in .NET Core

42 views
Skip to first unread message

Terry Aney

unread,
May 19, 2024, 7:58:24 PMMay 19
to Excel-DNA
Hi Govert, as you know, I'm migrating .NET Framework AddIn to .NET Core.  I've implemented all my functions and have tested some and am able to debug into them fine.  But the overall spreadsheet wasn't working so I was trying to figure it out and I was unable to step into a function that I just verified is possible to step into in .NET Framework.  The formula is:

=BTRFilter( RBLInput!$DS$116:$EK$1116,"paymentFormCode,scenario,paymentFormCodeID/text",FALSE,"recordType","CURRENT","paymentFormSeq",0)

NET Framework Definition where I hit breakpoint:

Screenshot 2024-05-19 185430.png

.NET Core Version looks the same but I can't hit a breakpoint/debug it (just returns #VALUE):

Screenshot 2024-05-19 185454.png

Long shot, but any guesses?  I'll let you know if I figure out.

Terry

Govert van Drimmelen

unread,
May 21, 2024, 7:37:12 AMMay 21
to exce...@googlegroups.com

Hi Terry,

 

Maybe your use of a ‘nullable’ object support in newer C# is letting the compiler inject some null checks, and the way you call the function with specific parameters from the sheet then causes it to throw an exception before hitting your code.

 

I assume you’re using the ExcelDna Registration helpers (as you have default values and ‘params’, which are not normally supported). Maybe those helpers are not handling the nullable types correctly.

 

I suggest you experiment a bit with the function signature.

 

-Govert

 

From: exce...@googlegroups.com <exce...@googlegroups.com> On Behalf Of Terry Aney
Sent: Sunday, May 19, 2024 7:58 PM
To: Excel-DNA <exce...@googlegroups.com>
Subject: [ExcelDna] Debugging Not Working in .NET Core

 

Hi Govert, as you know, I'm migrating .NET Framework AddIn to .NET Core.  I've implemented all my functions and have tested some and am able to debug into them fine.  But the overall spreadsheet wasn't working so I was trying to figure it out and I was unable to step into a function that I just verified is possible to step into in .NET Framework.  The formula is:

 

=BTRFilter( RBLInput!$DS$116:$EK$1116,"paymentFormCode,scenario,paymentFormCodeID/text",FALSE,"recordType","CURRENT","paymentFormSeq",0)

 

NET Framework Definition where I hit breakpoint:

 

 

.NET Core Version looks the same but I can't hit a breakpoint/debug it (just returns #VALUE):

 

 

Long shot, but any guesses?  I'll let you know if I figure out.

 

Terry

--
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/422461c3-0756-4a71-b8cc-d4737459638fn%40googlegroups.com.

image001.png
image002.png

Terry Aney

unread,
May 21, 2024, 10:10:42 AMMay 21
to Excel-DNA
Thanks, you got me to the right spot.  In my .NET Framework code I had this:

ExcelRegistration
.GetExcelFunctions()
.ProcessParamsRegistrations()
.RegisterFunctions();

In my .NET Core version, I was copying this sample from Registration repo and had the following code.

/// <summary>
/// Modify the Excel-DNA function registration, by applying various transformations before the functions are registered.
/// </summary>
private static void RegisterFunctions()
{      
    ExcelRegistration
        .GetExcelFunctions()
        .Select( UpdateHelpTopic )
        .RegisterFunctions();
}

private static ExcelFunctionRegistration UpdateHelpTopic( ExcelFunctionRegistration funcReg )
{
    // TODO: Ability to run markdown help files locally.
    funcReg.FunctionAttribute.HelpTopic = "http://www.bing.com";
    return funcReg;
}


You can see it was missing the 'ProcessParamsRegistrations'.  Adding that made it work with function signature as is.

Curious, when would you ever *not need* ProcessParamsRegistrations?
Reply all
Reply to author
Forward
0 new messages