SC20260D NetworkController.FromName throws Null Exception

This line :
var networkController = NetworkController.FromName($"GHIElectronics.TinyCLR.NativeApis.STM32H7.EthernetEmacController\0");

Is throwing this exception:
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### GHIElectronics.TinyCLR.Devices.Network.Provider.NetworkControllerApiWrapper::.ctor [IP: 000e] ####
#### GHIElectronics.TinyCLR.Devices.Network.NetworkController::FromName [IP: 000c] ####
#### GalaxyNetmfCP.Drivers.NetworkDriver::Start [IP: 003e] ####
#### PervasiveDigital.Galaxy.Core.NodeEngine::Initialize [IP: 004f] ####
#### GalaxyNetmfCP.Program::Main [IP: 0034] ####
Exception thrown: ‘System.NullReferenceException’ in GHIElectronics.TinyCLR.Devices.Network.dll

Am I doing something wrong here? This is an SC20260D dev board with TinyCLR20.-preview4 and I verified that the name appears in NativeApi.FindAll()

try using just the escaped string or mark it as a string literal. $ is just for an interpolated string (i.e. “{variable}”; ). so,
“GHIElectronics.TinyCLR.NativeApis.STM32H7.EthernetEmacController\\0”
or
@“GHIElectronics.TinyCLR.NativeApis.STM32H7.EthernetEmacController\0”

@Dat_Tran and @Joel_Riley what is the proper name here from SITCore? We should not use stm32 name anywhere. We should search the entire docs and fix as well.

1 Like

Aaaaargh. ‘$’ != ‘@’. It was a typo. Thanks Phil! Works like a charm now.

That’s an hour that I’ll never get back.

Sometime all it takes is another set of eyes. I assure you, I have spent more time on less…

2 Likes