I've googled the error the script below generates, at a basic level it seems to arise due to a null value somewhere. I tried to specify a specific set of classes for Assembly.... got really confused. I'd like to get more than just a count for ExportedTypes.
;Winbatch 2020A - Exported Types
ObjectClrOption('useany', 'System')
ObjectClrOption('useany', 'System.Reflection')
oTypes = ObjectClrNew('System.Reflection.Assembly','PublicNestedClass')
eTypes = oTypes.GetExportedTypes()
ct = eTypes.Count
oTypes =0
Message("Exported Types",ct)
Exit
You're getting the error because you don't have a target. The assembly class needs an assembly to be able to return information about one and it does not have a constructor that takes parameters. If fact, it is surprising that the CLR didn't throw an exception. Type classes are generic so translating C# to WIL CLR is tricky but check out the CreatInstance methods.
Still confused over 'target'... snippet below gets same error
ObjectClrOption('useany', 'System.Reflection')
oTypes = ObjectClrNew('System.Reflection.Assembly')
oAssembly = oTypes.CreateInstance('System.Drawing')
etypes=""
ForEach t in oAssembly.GetExportedTypes()
etypes := t
Next
Not sure what you are trying to accomplish but perhaps a refresher would help. Here is a link to a script Diana wrote many moons ago.
https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/dotNet/System_Reflection+Get~Assembly~Properties.txt
I found what I was looking for with another route.