Does TinyCLR Implement ResourceUtility Class

Hey Guys,

I was trying to port over some code from .NETMF to TinyCLR OS and was not sure what to substitute Microsoft.SPOT.ResourceUtility.GetObject() with. Below is an example of Microsoft.SPOT.ResourceUtility.GetObject() being used in my project.

internal static byte[] GetBytes(Resources.BinaryResources id)
{
return ((byte[])(Microsoft.SPOT.ResourceUtility.GetObject(ResourceManager, id)));
}

I would recommend recreating your resources file instead and let the tool generate the codebehind for you. TinyCLR resources were changed from NETMF’s to more closely align with the desktop.

I have recreated the resource files, but when tool generates the code it is missing some methods such as GetBytes()

Is the file properly being added to the binary resources? GetBytes appears for me as expected when adding a .bin file.

Thanks John, I was able to get it to work

I have encountered another problem related to this topic and was wondering if anyone had a solution for it. I am trying to make new XmlReader instance using a memory stream that contains data from a binary resource file, but it keeps throwing an argumentNullexception followed by a CS7069 error. I was wondering how I can go about fixing this since System.IO.TestReader is not part of mscorlib in TinyCLR OS. Below is the line of code and the error.

XmlReader xmlReader = XmlReader.Create(newMemoryStream(data), xmlReaderSettings);

CS7069 C# Reference to type ‘TextReader’ claims it is defined in ‘mscorlib’, but it could not be found

It’s probably because you added a reference to an XML library not meant for TinyCLR. That library is built against a different mscorlib, hence the error about TextReader.

Yea you are right, that is the case. So is there currently no alternative for System.XML

At this time, not out of the box, no.

Do you have any suggestions on how I would currently be able to implement it, and also when do you guys plan on having XML supported in TinyCLR OS

The .NET Core Framework source may be a good place to start for an XML implementation. The problem with NETMF’s is that it was integrated into the core so there’s not much managed code to use. We don’t have a timeline on when, or if, System.Xml will return.

Thanks, I was wondering if BinaryReader has been implemented into TinyCLR, as I might be able to use that instead.

BinaryReader isn’t in the current release. We will be looking into it though. In the mean time, GHIElectronics.TinyCLR.Storage.Streams.DataReader may be useful to you.