Costs against the Crown necessarily require Crown misconduct or a serious interference with the authority of the court or administration of justice. 
Costs against the Crown are "an exceptional or remarkable event". Costs may be ordered as a remedy to a Charter breach. Not just any Charter breach will result in costs. It should be conduct where the Crown is "reponsible for some misconduct, complicit in it, or other unique circumstances exist."
The reason behind this is that costs would have the effect of deterring the Crown from exercising their duties in the public interest to the fullest extent.
While there is no closed list of circumstances, situations where costs may be ordered against the Crown is where the prosecution has been (1) frivolous, (2) for an oblique motive, or (3) where the Crown has taken up the matter as a test case.
The "jurisdiction for awarding costs in criminal matters is extremely narrow and the threshold is very high."
In determining whether there should be costs against the Crown, the Court may apply its "inherent power to protect against abuse of process".
A provincial court has no jurisdiction to order punitive costs against the defence.
A preliminary inquiry judge does not have the jurisdiction to make orders of cost against the crown.
A Youth Justice Court sitting as a trial court has jurisdiction to award costs against the Crown for a Charter breach.
Where the accused has been arraigned and entered a plea before a court of competent jurisdiction, that court becomes the trial court which may be able to hear costs even after a stay of proceedings is entered.
A bail hearing judge under section 515 (1) is not a "court of competent jurisdiction" within the meaning of section 24 (1) of the Charter and so has no jurisdiction to order costs against the Crown.
Case management roles created under section 482(3)(c) cannot convey jurisdiction upon the provincial court to order costs outside of the Charter or the Criminal Code.
Costs Against the Crown
Costs against the Crown are "rare" but are permitted when they are "integrally connected to the court's control of its trial process, and are intended as a means of disciplining and discouraging behaviour".
Costs Against Defence
There has been some suggestion that costs may also be ordered against the defence in certain circumstances.
Under s. 676.1, a party ordered to pay costs may appeal the order and amount with leave to the court of appeal.
Costs as a remedy for failure to provide timely disclosure requires that there be a "marked and unacceptable departure from the reasonable standards expected of the prosecution". It is not necessary to establish a "flagrant disregard for the accused's rights" or "egregious conduct". 
A "test case" would be one where the Crown persues a valid social purpose by seeking to settle a point of law. This will incur a cost that should not be born by just one individual.
However, where the accused "has a significant practical stake in the prosecution, high public interest in the outcome of the proceedings" then it should not be considered a "test case".
R v Magda, 2006 CanLII 36822 (ON CA)
R v Griffin, 2009 ABQB 696 (CanLII) at para 176
- R v 974649 Ontario Inc, 2001 SCC 81 (CanLII),  3 SCR 575, at para 86
R v Singh, 2009 NSSC 306 (CanLII) at para 25 - it must be ordered by a superior court judge
R v Ralph, 2008 NLCA 71 (CanLII), at para 12
R v Pang, 1994 ABCA 371 (CanLII)
R v S.E.L., 2013 ABCA 45 (CanLII) at para 9
R v Taylor, 2008 NSCA 5 (CanLII) at para 43
Ralph at para 13
Taylor at para 43
R v King 1986 CanLII 1156 (BC CA), (1986), 26 CCC (3d) 349 (BCCA) per Lambert J.A. at para 13
see also R v Neustaedter, 2003 BCSC 39 (CanLII) at para 7
- R v Leyshon‑Hughes, 2009 ONCA 16 (CanLII), 240 CCC (3d) 181 at para 55
- Canada (Attorney General) v Foster 2006 CanLII 38732(ON CA), (2006), 215 CCC (3d) 59 (Ont. C.A.) at para 69
R v Gunn, 2003 ABQB 314 (CanLII) at para 48
- Howard 2009 PECA 27 – Application for costs due to delay of disclosure
R v Mills, 1986 CanLII 17 (SCC),  1 SCR 863
R v Conway, 2010 SCC 22 (CanLII),  1 SCR 765
R v 974649 Ontario Inc., 2001 SCC 81 (CanLII), (2001), 159 CCC (3d) 321
R v C.W., 2011 ABPC 205 (CanLII) - re Youth Justice Court
R v Pang, 1994 ABCA 371 (CanLII) - provincial court permitted in some circumstances
- R v Menard, 2008 BCCA 521 (CanLII)
- R v Campbell, 2008 BCSC 805 (CanLII)
R v Kocet, 2016 ONCJ 329 (CanLII) at para 6
R v Singh, 2016 ONCA 108 (CanLII)
R v Ferncan Developments, 2016 ONCA 269 (CanLII)
- R v Dumont, 2002 ABPC 44 (CanLII)
R v Henkel, 2003 ABCA 23 (CanLII),  A.J. No. 51 (ABCA)
R v Branton, 2010 NLTD 207 (CanLII) - costs awarded for delayed disclosure
Ralph at para 15
R v Trask, 1987 CanLII 24 (SCC),  2 SCR 304, at pp.307-308
Ralph at para 18
Costs Personally Against Counsel
In exceptional cases costs can be awarded against a lawyer personally. This typically is where there is some form of wilful misconduct or dishonesty.
e.g. A.G. Quebec v Cronier (1981), 63 CCC (3d) 437 (Que. C.A.) at pp. 448-449
Pacific Mobile Corp. V. Hunter Douglas  SCR 482
Kelsie v S & A Realty Ltd. , 39 N.S.R. (2d) at p 483 (NSCA) see also paras 18 and 21
- R v Brown, 2009 ONCA 633 (CanLII) - costs of $2000 for Crown continued delay of bail hearing for several weeks. Habeas Corpus application granted.
- R v Kelln, 2003 SKPC 1 (CanLII) - $500 costs against Crow for failure to provide officer notes on a timely manner. Notes were provided 11 months after request.
- R v Yeun,  A.J. No. 1122 - costs against crown awarded for failure to provide disclosure ($2,200).
- R v C.B.R.  NSJ 392 - costs award against crown for preferring a direct indictment only days before trial causing it to be adjourned was overturned.
- Disclosure - see section on costs as remedy