Inaccurate / Incomplete docs

Trying to get the SD card code to work as posted in the beginner’s guide and note that its missing a critical piece of info: The assembly to load / reference for the FileStream object.

The code as written will not work until there’s an assembly or reference provided to define that class.

Noticing this on a number of code examples - where’s the complete documentation? (Or is that a red herring?)

How are we supposed to guess which assembly to reference??


Ok, some confusion here…

Can someone explain why FileStream remains undefined if I have “using System.IO;” at the top of my source, and only works when I add System.IO to the References?

I think what I need is an idea of what is foundational to the device/environment and what’s not.
For instance, in regular C# land, I don’t need to add a reference to SYSTEM.IO in references - I just add one to SYSTEM, but here I do… what gives???

We are dealing with two main concepts here - namespace and assembly. Namespace is a virtual thing it can spread multiple assemblies as well as one assembly can have classes and interfaces that belong to many different namespaces.
When we add a reference to an assembly (dll) a list of all namespaces from that assembly is created as well as classes that belong to each namespace that are defined in that assembly. When we put “using” we just tell compiler that we intend to use classes from that namespace. However if a class from the same namespace happens to be in different assembly that is not referenced - you will get undefined error.

Why is it different from regular .Net? MF supposed to run on many devices with different capabilities. Part of the IO is supported on many devices, but file support for example is only available on some. That is why namespace/assembly separation on MF is more granular.

In this particular case there is indeed the documentation issue with FileStream on Microsoft site
It states that FileStream is in mscorlib.dll, but it is in System.IO.dll. But there is also a comment in the “Community Content” on that page that describes the issue and point out to the right location.

@ Architect

Thanks. The issue is that newbies like me aren’t seeing these pitfalls in the beginners guide. :frowning: My expectation level when reading such material is to have all References and Using statements spelled out because newbies are in learning mode when they’re reading a beginners guide. When you try to use the provided example and it doesn’t work, you drop out of learning mode and enter black-hole mode. :o

That little nugget about System.IO really should be put in the paragraph before the code example on Page 61, and any other example code [italic]for the purpose of instruction[/italic] really should have all references and using statements spelled out.

In regular .NET, you do not add a reference to System.IO.dll in the solution references to use FileStream or any of the StreamWriter definitions; all you do is add a using statement: “using System.IO” to include the appropriate namespace in your code.

This is where I got hung up.

You are more then welcome to add this to the wiki as that is community driven.