If Bob goes up to Alice with a knife and threatens to cut her, obviously that's illegal. But what if Bob points the knife at himself, and threatens to hurt/kill himself? Assuming he's subdued before he can hurt himself, can Bob face legal action? As a related follow-up, what if Bob asked XYZ of Alice, or else he would hurt/kill himself? Would that qualify as extortion, or something similar?
Bob can ultimately be detained to prevent self harm, while self-harm is not fully legal, it is not generally a crime, however if Bob is a member of one of the Fort Peck tribes, it constitutes "aggravated disorderly conduct" which is a crime. So it partially depends on what you mean by "illegal", and partly on who Bob is. This is irrespective of whether there is an Alice. Bob can also be detained if it is reasonable to believe that he is threatening Alice, and the description of the circumstances does not establish that it is unreasonable to believe that he threatened Alice.
Under the Criminal Code, assault (including threats of force) requires the target to be "another person" (see s. 265). Bob does not commit the offence of assault by threatening to harm himself.
If Bob persuades or induces Alice to commit an offence and Alice follows through with it, then Bob is a party to that offence (s. 22).
If Bob persuades or induces Alice to commit an offence but Alice does not commit the offence, then Bob is guilty of the standalone offence of "counselling an offence that is not committed" (s. 464).