Brushfire Meet
Brushfire Meet

Reputation: 95

Exception : Foundation.You_Should_Not_Call_base_In_This_Method

I am trying to implement IDtech Unimag card reader. I have already got the c# binding library for UniMag native code. To create the unimag object I am writing below given code.

_uniMagReader = new uniMag ();
//_uniMagReader.ReaderType = BrushfireUniMagBinding.UmReader.Shuttle;
_uniMagReader.SetAutoAdjustVolume(true);
_uniMagReader.SetSwipeTimeoutDuration (0);
_uniMagReader.SetAutoAdjustVolume (true);
_uniMagReader.StartUniMag (true);

On the third line, _uniMagReader.SetAutoAdjustVolume(true), I am getting this exeption:

Foundation.You_Should_Not_Call_base_In_This_Method: Exception of type 'Foundation.You_Should_Not_Call_base_In_This_Method'.

I have no clue why I am getting this exception. I searched for the same exception but I didn't get what the answer actually meant.

My Unimag converted file looks like:

using Foundation;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace BrushfireUniMagBinding
{
    [Model, Register ("uniMag", false)]
    public class uniMag : NSObject
    {
        //
        // Properties
        //
        [CompilerGenerated]
        public virtual UmReader ReaderType {
            [Export ("readerType")]
            get;
            [Export ("setReaderType:")]
            set;
        }

        //
        // Constructors
        //
        [Export ("init"), EditorBrowsable (EditorBrowsableState.Advanced), CompilerGenerated]
        public uniMag ();

        [EditorBrowsable (EditorBrowsableState.Advanced), CompilerGenerated]
        protected uniMag (NSObjectFlag t);

        //
        // Static Methods
        //
        [Export ("enableLogging:"), CompilerGenerated]
        public static void EnableLogging (bool enable);

        [Export ("SDK_version"), CompilerGenerated]
        public static string SDK_version ();

        //
        // Methods
        //
        [Export ("autoDetect:"), CompilerGenerated]
        public virtual void AutoDetect (bool autoDetect);

        [Export ("cancelSwipe"), CompilerGenerated]
        public virtual void CancelSwipe ();

        [Export ("cancelTask"), CompilerGenerated]
        public virtual void CancelTask ();

        [Export ("closeConnection"), CompilerGenerated]
        public virtual void CloseConnection ();

        [Export ("getAuthentication"), CompilerGenerated]
        public virtual UmRet GetAuthentication ();

        [Export ("getConnectionStatus"), CompilerGenerated]
        public virtual bool GetConnectionStatus ();

        [Export ("getFlagByte"), CompilerGenerated]
        public virtual NSData GetFlagByte ();

        [Export ("getRunningTask"), CompilerGenerated]
        public virtual UmTask GetRunningTask ();

        [Export ("getVolumeLevel"), CompilerGenerated]
        public virtual float GetVolumeLevel ();

        [Export ("getWave"), CompilerGenerated]
        public virtual NSData GetWave ();

        [Export ("isReaderAttached"), CompilerGenerated]
        public virtual bool IsReaderAttached ();

        [Export ("proceedPoweringUp:"), CompilerGenerated]
        public virtual UmRet ProceedPoweringUp (bool proceedPowerUp);

        [Export ("promptForConnection:"), CompilerGenerated]
        public virtual void PromptForConnection (bool prompt);

        [Export ("requestSwipe"), CompilerGenerated]
        public virtual UmRet RequestSwipe ();

        [Export ("sendCommandClearBuffer"), CompilerGenerated]
        public virtual UmRet SendCommandClearBuffer ();

        [Export ("sendCommandCustom:"), CompilerGenerated]
        public virtual UmRet SendCommandCustom (NSData cmd);

        [Export ("sendCommandDefaultGeneralSettings"), CompilerGenerated]
        public virtual UmRet SendCommandDefaultGeneralSettings ();

        [Export ("sendCommandDisableErrNotification"), CompilerGenerated]
        public virtual UmRet SendCommandDisableErrNotification ();

        [Export ("sendCommandDisableExpDate"), CompilerGenerated]
        public virtual UmRet SendCommandDisableExpDate ();

        [Export ("sendCommandDisableForceEncryption"), CompilerGenerated]
        public virtual UmRet SendCommandDisableForceEncryption ();

        [Export ("sendCommandEnableAES"), CompilerGenerated]
        public virtual UmRet SendCommandEnableAES ();

        [Export ("sendCommandEnableErrNotification"), CompilerGenerated]
        public virtual UmRet SendCommandEnableErrNotification ();

        [Export ("sendCommandEnableExpDate"), CompilerGenerated]
        public virtual UmRet SendCommandEnableExpDate ();

        [Export ("sendCommandEnableForceEncryption"), CompilerGenerated]
        public virtual UmRet SendCommandEnableForceEncryption ();

        [Export ("sendCommandEnableTDES"), CompilerGenerated]
        public virtual UmRet SendCommandEnableTDES ();

        [Export ("sendCommandGetNextKSN"), CompilerGenerated]
        public virtual UmRet SendCommandGetNextKSN ();

        [Export ("sendCommandGetSerialNumber"), CompilerGenerated]
        public virtual UmRet SendCommandGetSerialNumber ();

        [Export ("sendCommandGetSettings"), CompilerGenerated]
        public virtual UmRet SendCommandGetSettings ();

        [Export ("sendCommandGetVersion"), CompilerGenerated]
        public virtual UmRet SendCommandGetVersion ();

        [Export ("sendCommandResetBaudRate"), CompilerGenerated]
        public virtual UmRet SendCommandResetBaudRate ();

        [Export ("sendCommandSetPrePAN:"), CompilerGenerated]
        public virtual UmRet SendCommandSetPrePAN (int prePAN);

        [Export ("setAutoAdjustVolume:"), CompilerGenerated]
        public virtual void SetAutoAdjustVolume (bool b);

        [Export ("setAutoConnect:"), CompilerGenerated]
        public virtual void SetAutoConnect (bool autoConnect);

        [Export ("setCmdTimeoutDuration:"), CompilerGenerated]
        public virtual bool SetCmdTimeoutDuration (int seconds);

        [Export ("setDeferredActivateAudioSession:"), CompilerGenerated]
        public virtual void SetDeferredActivateAudioSession (bool b);

        [Export ("setFirmwareFile:"), CompilerGenerated]
        public virtual bool SetFirmwareFile (string location);

        [Export ("setSwipeTimeoutDuration:"), CompilerGenerated]
        public virtual bool SetSwipeTimeoutDuration (int seconds);

        [Export ("setWavePath:"), CompilerGenerated]
        public virtual bool SetWavePath (string path);

        [Export ("startUniMag:"), CompilerGenerated]
        public virtual UmRet StartUniMag (bool start);

        [Export ("updateFirmware:"), CompilerGenerated]
        public virtual UmRet UpdateFirmware (string encrytedBytes);

        [Export ("updateFirmware2:stringWithFile:"), CompilerGenerated]
        public virtual UmRet UpdateFirmware2 (string stringWithFile, string path);
    }
}

Can anyone guide me in this situation?

Thanks in advance.

Upvotes: 1

Views: 2803

Answers (1)

JoeTomks
JoeTomks

Reputation: 3276

So the exception You_Should_Not_Call_base_In_This_Method means that the method SetAutoAdjustVolume(bool) is calling something like Base.SetAutoAdjustVolume(bool) within it's parent method within the bound library.

You would likely need to override the SetAutoAdjustVolume(bool) method in order to ensure that it is not calling Base.

[Export ("setAutoAdjustVolume:"), CompilerGenerated]
public virtual void SetAutoAdjustVolume (bool b);

Essentially the compiler generated binding to this method needs to be overridden before you can use it in your code.

You could create a new class that derives from uniMag and override the SetAutoAdjustVolume method to ensure that base is not called for example.

Upvotes: 2

Related Questions