DarthFubuMVC/fubucore — pull request #62 by KevM (2013-02-11 23:17:10+00:00)
Title: Loadfromfile

_Originaly posted this to the mailing list:_

Ran into a misleading error message in the Bottles package loader that is originating when FubuCore's IFileSystem tries to load XML and the file does not exist or, in our case, does not have read access.

Below is what the developer sees in this scenario.
~~~
------------------------------------------------------------------------------------------------
Errors
------------------------------------------------------------------------------------------------
Bottling Process finished on 2/11/2013 at 2:53:29 PM
System.ArgumentException: 1 bottles are missing a name
(C:\repo\github\agent\source\Agent.Support)

at Bottles.BottleDependencyProcessor.guardAgainstMalformedPackages()
at Bottles.BottleDependencyProcessor..ctor(IEnumerable`1 packages)
at Bottles.PackagingRuntimeGraph.DiscoverAndLoadPackages(Action onAssembliesScanned, Boolean runActivators)
at Bottles.Diagnostics.PackageLog.Execute(Action continuation)"
~~~

Right now when this Bottles package loader is tring to get its manifest from an XML file. [When that file does not exist it returns a new T](https://github.com/DarthFubuMVC/fubucore/blob/master/src/FubuCore/FileSystem.cs#l180) and later down the pipe the Bottles package loader complains that there is no package manifest name.

I am hoping to improve the developer experience here.

As much as I don't like LoadFromFile's behavior here, FubuCore is 1.0 so making this use case throw an exception would be a breaking change. I could add a new LoadFromFile overload to FubuCore that throws or returns context for IO related failures.

If you are OK with me patching LoadFromFile to throw rather than create an empty instance please reject this pull request and I'll patch the original method.