none
CallbackOnCollectedDelegate RRS feed

  • 问题

  • 遇见个问题

    A callback was made on a garbage collected delegate of type 'VertXReader!VertXReader.VertXBusinessObject+SmallStringFP::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.

     

    英文版找到一些http://bytes.com/topic/c-sharp/answers/540633-callback-garbage-collected-delegate-error

    但是还是没有办法解决~求高手指点

     

    code:

    public

    delegate void SmallStringFP(StringBuilder arr);

     

    SmallStringFP oSmallStringFP = null;

    public

     

    void SetCallBackFunc(string locaId, string macAddr, bool

    inOut)

    {

     

    int resultSign = -1;

    oSmallStringFP = new SmallStringFP(GetLookup);

    resultSign = SetLookupCallback(oSmallStringFP);

     

    int level = 25;

    resultSign =

    VertXAccessObject.DebugLevel(1, ref level);

    TurnOnBeeper(macAddr, 500);

    }

     
    2011年6月17日 8:14

答案