Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPF version throws FileNotFound Exception #58

Open
tkouba opened this issue Aug 15, 2019 · 0 comments
Open

WPF version throws FileNotFound Exception #58

tkouba opened this issue Aug 15, 2019 · 0 comments

Comments

@tkouba
Copy link

tkouba commented Aug 15, 2019

WPF version of SimpleAudioPlayer has wrong name of assembly. So on use throws FileNotFoundException with

FileName	"Plugin.SimpleAudioPlayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"	string

But dll name is "Plugin.SimpleAudioPlayer.WPF.dll"

Workaround:

    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolver); 
            Xamarin.Forms.Forms.Init();
            base.OnStartup(e);
        }

        private Assembly AssemblyResolver(object sender, ResolveEventArgs args)
        {
            if (args.Name.StartsWith("Plugin.SimpleAudioPlayer", StringComparison.CurrentCultureIgnoreCase))
            {
                return Assembly.LoadFrom("Plugin.SimpleAudioPlayer.WPF.dll");
            }
            return null;
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant