I would go one way or the other, but not both.
If you expect the user to call CanExecute, then don't call it in Execute. You've already set that expectation in your interface and now you have a contract with all the developers that implies this sort of interaction with ICommand.
However, if you're worried about developers not utilizing it properly (as you could rightfully be), then I would suggest removing it from the interface completely, and making it an implementation concern.
Example:
interface Command {
void Execute(object parameters);
}
class CommandImpl: ICommand {
public void Execute(object parameters){
if(!CanExecute(parameters)) throw new ApplicationException("...");
/** Execute implementation **/
}
private bool CanExecute(object parameters){
//do your check here
}
}
This way, you're contract (interface) is clear and concise, and you won't be confused about whether or not CanExecute is getting called twice.
However, if you're actually stuck with the interface because you don't control it, another solution could be to store the results and check it like this:
interface Command {
void Execute(object parameters);
bool CanExecute(object parameters);
}
class CommandImpl: ICommand {
private IDictionary<object, bool> ParametersChecked {get; set;}
public void Execute(object parameters){
if(!CanExecute(parameters)) throw new ApplicationException("...");
/** Execute implementation **/
}
public bool CanExecute(object parameters){
if (ParametersChecked.ContainsKey(parameters))
return ParametersChecked[parameters];
var result = ... // your check here
//method to check the store and add or replace if necessary
AddResultsToParametersChecked(parameters, result);
}
}