升级到 Delphi 10.4 悉尼时缺少 ToolsAPI 接口方法的实现
Missing implementation for ToolsAPI interface method when upgrading to Delphi 10.4 Sydney
我已经在新虚拟机中安装了 Delphi 10.4 Sydney w/ Patch 2,并将 Delphi 10.3 Tokyo 源复制到它。
重建可视化工具(对于 DevExpress TcxSchedulerEvents)时出现此错误:
[dcc32 Error] EventVisualizr.pas(19): E2291 Missing implementation of interface method IOTAThreadNotifier.EvaluateComplete
我只删除了编译包cxLibraryRS26
、cxSchedulerRS26
、dxCoreRS26
、dxGDIPlusRS26
,并添加了cxLibraryRS27
、cxSchedulerRS27
、 dxCoreRS27
、dxGDIPlusRS27
- 没有其他代码更改:
我在 TEventViewerFrame
类型定义的第一行收到错误:
unit EventVisualizr;
// Copied and modified from TStringListVisualizer. Shows values for TcxSchedulerEvent properties:
// - ID
// - Caption
// - Custom property tt_fromdate (if it exists)
// - Custom property tt_todate (if it exists)
// - Start
// - Finish
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolsAPI, Vcl.ExtCtrls;
type
TAvailableState = (asAvailable, asProcRunning, asOutOfScope, asNotAvailable);
TEventViewerFrame = class(TFrame, IOTADebuggerVisualizerExternalViewerUpdater, IOTAThreadNotifier, IOTAThreadNotifier160)
EventListView: TListView;
procedure EventListViewData(Sender: TObject; Item: TListItem);
private
FOwningForm: TCustomForm;
FClosedProc: TOTAVisualizerClosedProcedure;
FNotifierIndex: Integer;
FCompleted: Boolean;
FDeferredResult: string;
FDeferredError: Boolean;
FPropValues,
FPropNames: TStrings;
FAvailableState: TAvailableState;
function Evaluate(Expression: string): string;
protected
procedure SetParent(AParent: TWinControl); override;
public
procedure CloseVisualizer;
procedure MarkUnavailable(Reason: TOTAVisualizerUnavailableReason);
procedure RefreshVisualizer(const Expression, TypeName, EvalResult: string);
procedure SetClosedCallback(ClosedProc: TOTAVisualizerClosedProcedure);
procedure SetForm(AForm: TCustomForm);
procedure AddEventItems(const Expression, TypeName, EvalResult: string);
{ IOTAThreadNotifier }
procedure AfterSave;
procedure BeforeSave;
procedure Destroyed;
procedure Modified;
procedure ThreadNotify(Reason: TOTANotifyReason);
procedure EvaluteComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress, ResultSize: LongWord; ReturnCode: Integer);
procedure ModifyComplete(const ExprStr, ResultStr: string; ReturnCode: Integer);
{ IOTAThreadNotifier160 }
procedure EvaluateComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress: TOTAAddress; ResultSize: LongWord; ReturnCode: Integer);
end;
在 ToolsAPI.pas
中,两者都有 EvaluateComplete
定义,但在该源文件中没有实现:
IOTAThreadNotifier = interface(IOTANotifier)
['{34B2E2D7-E36F-11D1-AB0E-00C04FB16FB3}']
{ This is called when the process state changes for this thread }
procedure ThreadNotify(Reason: TOTANotifyReason);
{ This is called when an evaluate that returned erDeferred completes.
ReturnCode <> 0 if error }
procedure EvaluateComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress, ResultSize: LongWord; ReturnCode: Integer);
{ This is called when a modify that returned erDeferred completes.
ReturnCode <> 0 if error }
procedure ModifyComplete(const ExprStr, ResultStr: string; ReturnCode: Integer);
end;
IOTAThreadNotifier160 = interface(IOTAThreadNotifier)
['{46F94C52-E225-4054-A5F0-F5E67E29B2C2}']
{ This is called when an evaluate that returned erDeferred completes.
ReturnCode <> 0 if error }
procedure EvaluateComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress: TOTAAddress; ResultSize: LongWord; ReturnCode: Integer); overload;
end;
比较 ToolsAPI 文件时,我看到:
- 它在 10.3 中被命名为
EvaluteComplete
(缺少 'a')并且已被修复为 EvaluateComplete
IOTAThreadNotifier160.EvaluateComplete
现在有一个重载指令(当然,与我认为的问题无关)
改名会不会是原因?在 10.3 版本中也没有 EvaluateComplete
过程的 'implementation'(这似乎很好,因为我对接口知之甚少)。
从Why do I get the error Missing implementation of interface method in Delphi XE2? and Why do I get error Missing implementation?,我知道错误的原因可能是参数列表不同,但在这种情况下我不知道在哪里寻找正确的。
您的 TEventViewerFrame
仍然包含 'old' EvaluteComplete
的实现。
通过简单地将 TEventViewerFrame.EvaluteComplete
重命名为 TEventViewerFrame.EvaluateComplete
来修复它(以满足新的接口契约)。
我已经在新虚拟机中安装了 Delphi 10.4 Sydney w/ Patch 2,并将 Delphi 10.3 Tokyo 源复制到它。
重建可视化工具(对于 DevExpress TcxSchedulerEvents)时出现此错误:
[dcc32 Error] EventVisualizr.pas(19): E2291 Missing implementation of interface method IOTAThreadNotifier.EvaluateComplete
我只删除了编译包cxLibraryRS26
、cxSchedulerRS26
、dxCoreRS26
、dxGDIPlusRS26
,并添加了cxLibraryRS27
、cxSchedulerRS27
、 dxCoreRS27
、dxGDIPlusRS27
- 没有其他代码更改:
我在 TEventViewerFrame
类型定义的第一行收到错误:
unit EventVisualizr;
// Copied and modified from TStringListVisualizer. Shows values for TcxSchedulerEvent properties:
// - ID
// - Caption
// - Custom property tt_fromdate (if it exists)
// - Custom property tt_todate (if it exists)
// - Start
// - Finish
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolsAPI, Vcl.ExtCtrls;
type
TAvailableState = (asAvailable, asProcRunning, asOutOfScope, asNotAvailable);
TEventViewerFrame = class(TFrame, IOTADebuggerVisualizerExternalViewerUpdater, IOTAThreadNotifier, IOTAThreadNotifier160)
EventListView: TListView;
procedure EventListViewData(Sender: TObject; Item: TListItem);
private
FOwningForm: TCustomForm;
FClosedProc: TOTAVisualizerClosedProcedure;
FNotifierIndex: Integer;
FCompleted: Boolean;
FDeferredResult: string;
FDeferredError: Boolean;
FPropValues,
FPropNames: TStrings;
FAvailableState: TAvailableState;
function Evaluate(Expression: string): string;
protected
procedure SetParent(AParent: TWinControl); override;
public
procedure CloseVisualizer;
procedure MarkUnavailable(Reason: TOTAVisualizerUnavailableReason);
procedure RefreshVisualizer(const Expression, TypeName, EvalResult: string);
procedure SetClosedCallback(ClosedProc: TOTAVisualizerClosedProcedure);
procedure SetForm(AForm: TCustomForm);
procedure AddEventItems(const Expression, TypeName, EvalResult: string);
{ IOTAThreadNotifier }
procedure AfterSave;
procedure BeforeSave;
procedure Destroyed;
procedure Modified;
procedure ThreadNotify(Reason: TOTANotifyReason);
procedure EvaluteComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress, ResultSize: LongWord; ReturnCode: Integer);
procedure ModifyComplete(const ExprStr, ResultStr: string; ReturnCode: Integer);
{ IOTAThreadNotifier160 }
procedure EvaluateComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress: TOTAAddress; ResultSize: LongWord; ReturnCode: Integer);
end;
在 ToolsAPI.pas
中,两者都有 EvaluateComplete
定义,但在该源文件中没有实现:
IOTAThreadNotifier = interface(IOTANotifier)
['{34B2E2D7-E36F-11D1-AB0E-00C04FB16FB3}']
{ This is called when the process state changes for this thread }
procedure ThreadNotify(Reason: TOTANotifyReason);
{ This is called when an evaluate that returned erDeferred completes.
ReturnCode <> 0 if error }
procedure EvaluateComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress, ResultSize: LongWord; ReturnCode: Integer);
{ This is called when a modify that returned erDeferred completes.
ReturnCode <> 0 if error }
procedure ModifyComplete(const ExprStr, ResultStr: string; ReturnCode: Integer);
end;
IOTAThreadNotifier160 = interface(IOTAThreadNotifier)
['{46F94C52-E225-4054-A5F0-F5E67E29B2C2}']
{ This is called when an evaluate that returned erDeferred completes.
ReturnCode <> 0 if error }
procedure EvaluateComplete(const ExprStr, ResultStr: string; CanModify: Boolean;
ResultAddress: TOTAAddress; ResultSize: LongWord; ReturnCode: Integer); overload;
end;
比较 ToolsAPI 文件时,我看到:
- 它在 10.3 中被命名为
EvaluteComplete
(缺少 'a')并且已被修复为EvaluateComplete
IOTAThreadNotifier160.EvaluateComplete
现在有一个重载指令(当然,与我认为的问题无关)
改名会不会是原因?在 10.3 版本中也没有 EvaluateComplete
过程的 'implementation'(这似乎很好,因为我对接口知之甚少)。
从Why do I get the error Missing implementation of interface method in Delphi XE2? and Why do I get error Missing implementation?,我知道错误的原因可能是参数列表不同,但在这种情况下我不知道在哪里寻找正确的。
您的 TEventViewerFrame
仍然包含 'old' EvaluteComplete
的实现。
通过简单地将 TEventViewerFrame.EvaluteComplete
重命名为 TEventViewerFrame.EvaluateComplete
来修复它(以满足新的接口契约)。