You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jesse MacFadyen (JIRA)" <ji...@apache.org> on 2013/09/21 00:22:52 UTC
[jira] [Commented] (CB-3608) Custom plugins not working on Windows
Phone 7
[ https://issues.apache.org/jira/browse/CB-3608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13773509#comment-13773509 ]
Jesse MacFadyen commented on CB-3608:
-------------------------------------
Not sure exactly what is happening without a complete posting I can look at.
Here are some suggestions:
1. Define your C# plugin code in the namespace WPCordovaClassLib.Cordova.Commands
2. Ensure that config.xml has a matching feature/plugin for your class :
Back in 2.5 I believe it looked like this:
{code}
<widget>
<plugins>
<plugin name="SendSMS"/>
...
{code}
And nowadays it looks like this:
{code}
<feature name="SendSMS">
<param name="wp-package" value="SendSMS" />
</feature>
{code}
3. The fact that it works on WP8 but not WP7 implies to me that there may be a class used that is not available in the WP7.1 SDK.
4. Check the 'Output' window of Visual Studio for any issues.
> Custom plugins not working on Windows Phone 7
> ---------------------------------------------
>
> Key: CB-3608
> URL: https://issues.apache.org/jira/browse/CB-3608
> Project: Apache Cordova
> Issue Type: Bug
> Components: WP7
> Affects Versions: 2.5.0
> Environment: Nokia Lumia 800, Emulator 7.1
> Reporter: Jeff Shillitto
> Assignee: Jesse MacFadyen
>
> I am trying to develop a plugin along these lines to send an SMS message. It works on WP8 without problem but not on Windows Phone 7. I have followed the guide here: http://cordova.apache.org/docs/en/2.6.0/guide_plugin-development_windows-phone_index.md.html#Developing%20a%20Plugin%20on%20Windows%20Phone as closely as possible and stripped the code back to it's most basic elements and it still does not work.
> Here are the basics of my code:
> Javascript:
> cordova.exec(null, null, "SendSMS", "send", []);
> Native C#:
> namespace Cordova.Extension.Commands
> {
> class SendSMS : BaseCommand
> {
> public void send(string options)
> {
> Debug.WriteLine("Hello Plugin");
> }
> }
> }
> I am getting errors:
> A first chance exception of type 'System.MethodAccessException' occurred in mscorlib.dll
> A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
> Additional information: FormatException
> As mentioned it all works fine in Windows Phone 8 but not in Windows Phone 7 so presuming it is some kind of bug.
> Of course my code includes the correct using statements and Javascript click handler etc.. but my Javascript runs without errors and C# code compiles and runs fine until the cordova.exec is called in the JavaScript.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira