“cannot find type system.systemexception in module

2019-03-06 02:50发布

问题:

I am coding in c# on Windows Phone 8.1, and I need to play an .mp3 file. The only simple way I am aware of doing this is through the "Microsoft.Phone.BackgroundAudio" reference. However when i try to reference "Microsoft.Phone" through the object browser, it throws the error "cannot find type system.systemexception in module mscorlib.dll". Here is the relevant code below:

using Microsoft.Phone.BackgroundAudio;

when i use this i get the "cannot find type system.systemexception in module mscorlib.dll" error. Later in the script if i try to use a function of BackgroundAudio, it obviously throws an error and asks about a reference. However the reference doesnt work.

I have tried a complete reinstall, which was suggested on stackoverflow when i researched this question.

Any help would be much appreciated. Thanks!

回答1:

I had this issue before and the problem was the Windows Phone. What I did was on the "Reference", I removed "Microsoft.Phone.dll". I read somewhere in the Microsoft's thread that Windows Phone does not accept third party library or additional DLL.

I found two links that can load or execute media files on Windows Phone:

  • http://www.windowsapptutorials.com/windows-phone/media/play-audio-file-windows-phone-app-using-media-element-control/
  • https://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj841209.aspx#declare_the_background_audio_task

Hope this helps or lead you somewhere..