  We use hybrid density functional calculations to assess n-type doping in
monoclinic (Al$_x$Ga$_{1-x}$)$_2$O$_3$ alloys. We focus on Si, the most
promising donor dopant, and study the structural properties, formation energies
and charge-state transition levels of its various configurations. We also
explore the impact of C and H, which are common impurities in metal-organic
chemical vapor deposition (MOCVD). In Ga$_2$O$_3$, Si$_{Ga}$ is an effective
shallow donor, but in Al$_2O_3$ Si$_{Al}$ acts as a DX center with a (+/-)
transition level in the band gap. Interstitial H acts as a shallow donor in
Ga$_2$O$_3$, but behaves as a compensating acceptor in n-type Al$_2O_3$.
Interpolation indicates that Si is an effective donor in
(Al$_x$Ga$_{1-x}$)$_2$O$_3$ up to 70% Al, but it can be compensated by H
already at 1% Al. We also assess the diffusivity of H and study complex
formation. Si$_{cation}$-H complexes have relatively low binding energies.
Substitutional C on a cation site acts as a shallow donor in Ga$_2$O$_3$, but
can be stable in a negative charge state in (Al$_x$Ga$_{1-x}$)$_2$O$_3$ when
x>5%. Substitutional C on an O site (C$_O$) always acts as an acceptor in
n-type (Al$_x$Ga$_{1-x}$)$_2$O$_3$, but will incorporate only under relatively
O-poor conditions. C$_O$-H complexes can actually incorporate more easily,
explaining observations of C-related compensation in Ga$_2$O$_3$ grown by
MOCVD. We also investigate C$_{cation}$-H complexes, finding they have high
binding energies and act as compensating acceptors when x>56%; otherwise the H
just passivates the unintentional C donors. C-H complex formation explains why
MOCVD grown Ga$_2$O$_3$ can exhibit record-low free-carrier concentrations, in
spite of the unavoidable incorporation of C. Our study highlights that, while
Si is a suitable shallow donor in ALGO alloys, control of unintentional
impurities is essential to avoid compensation.
