Skip to content

Avoiding exception in case when "LogicalName" wasn't provided for EmbeddedResource. #79

@FoggyFinder

Description

@FoggyFinder

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')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions