FsXaml
FsXaml copied to clipboard
Avoiding exception in case when "LogicalName" wasn't provided for EmbeddedResource.
Right now it's neccessary to specify LogicalName for EmbeddedResource like this:
<LogicalName>MainWindow.xaml</LogicalName>
I think it will be better to allow user skip this step or at least make it clearly what's went wrong. Current exception message just suggest checking that file is marked as Resource.
So, in function getEmbeddedResourceStream instead of:
let resourceName =
ass.GetManifestResourceNames()
|> Array.tryFind (fun n -> n.ToLowerInvariant().Trim() = file.ToLowerInvariant().Trim())
use
let file' = file.ToLowerInvariant().Trim()
let resourceName =
ass.GetManifestResourceNames()
|> Array.tryFind
(fun n ->
let n' = n.ToLowerInvariant().Trim()
n' = file' || n' = ass.GetName().Name.ToLowerInvariant().Trim() + "." + file')
Making this work with Resource and EmbeddedResource makes sense - I'm open to making this change provided it's tested and backwards compatible.
Initially I've thought about just minimal changes - one additional condition for name checking