Law of large numbers with one dependency: $\frac{1}{n}\sum_{i=1}^n g(X,Y_i)$ Let $\{Y_i\}_{i=1}^{\infty}$ be a sequence of independent and identically distributed (i.i.d.) random variables.  Let $X$ be another random variable (possibly dependent on $\{Y_i\}_{i=1}^{\infty}$).  Let $g:\mathbb{R}^2\rightarrow\mathbb{R}$ be a measurable function. Assume that $E[g(x,Y_1)]$ is well defined and finite for all $x \in \mathbb{R}$. 
I would like to know when there 
exists a deterministic function $f$ such that
$$ \lim_{n\rightarrow\infty} \frac{1}{n}\sum_{i=1}^n g(X, Y_i) = f(X) \quad \mbox{with prob 1} $$
I am particularly interested in the candidate function $f(x) = E[g(x, Y_1)]$.
I have been able to prove the result for the case when $X$ is discrete (see below). I am interested in results and/or counter-examples for more general cases.

Context: This question is a refinement of the question here: 
Strong law of large numbers for function of random vector: can we apply it for a component only?
In that link, I was able to prove the result always holds for $f(x)=E[g(x,Y_1)]$ when  $X$ takes values in a finite or countably infinite set.
 A: Here is a sufficient condition that follows from the discrete case.  

Let $\mathcal{X}\subseteq \mathbb{R}$ and $\mathcal{Y}\subseteq \mathbb{R}$ be sets such that $X \in \mathcal{X}$ and $Y_1 \in \mathcal{Y}$.  Recall that $\{Y_i\}_{i=1}^{\infty}$ is i.i.d. and $X$ is possibly dependent on $\{Y_i\}_{i=1}^{\infty}$.  Define $f(x) = E[g(x,Y_1)]$ for all $x \in \mathbb{R}$.  Define Property * as follows: 
Property *:
$$ \lim_{n\rightarrow\infty} \frac{1}{n}\sum_{i=1}^n g(X,Y_i) = f(X) \quad \mbox{ with prob 1} $$
Claim 1:
Property * holds whenever $\mathcal{X}$ is a finite or countably infinite set.
Proof: See answer here: 
Strong law of large numbers for function of random vector: can we apply it for a component only?
$\Box$
Claim 2:
Property * holds if $g$ satisfies the following “piecewise uniform continuity” property: For each $\epsilon>0$ there is a sequence of disjoint intervals $\{I_i^{(\epsilon)}\}_{i=1}^{\infty}$, each interval $I_i^{(\epsilon)}$ having a finite size (some intervals possibly being "degenerate" by consisting of a single point),  such that $\mathcal{X} \subseteq \cup_{i=1}^{\infty} I_i^{(\epsilon)}$ and for all $i \in \{1, 2, 3, \ldots\}$ and all $a,b \in I_i^{(\epsilon)}$ we have: 
$$ |g(a, y) - g(b,y)|\leq \epsilon \quad \forall y \in \mathcal{Y} $$
Proof: Fix $\epsilon>0$.  Then $X \in \cup_{i=1}^{\infty}I_i^{(\epsilon)}$ and there is a unique index $i(X)$ such that $X \in I_{i(X)}^{(\epsilon)}$.  Define $X_{\epsilon}$ as the discrete random variable that is equal to the midpoint of $I_{i(X)}^{(\epsilon)}$.   Then for all realizations of $X, \{Y_i\}$ we have: 
$$ |g(X_{\epsilon}, Y_k) - g(X, Y_k)| \leq \epsilon \quad \forall k \in \{1, 2, 3, …\}$$
Since $X_{\epsilon}$ is discrete, by Claim 1 we know
$$ \lim_{n\rightarrow\infty} \frac{1}{n} \sum_{i=1}^ng(X_{\epsilon}, Y_i) = f(X_{\epsilon}) \quad \mbox{ with prob 1} $$
For all $n$ we have
\begin{align}
\left|\frac{1}{n}\sum_{i=1}^n g(X,Y_i)-f(X)\right|&\leq \underbrace{\left|\frac{1}{n}\sum_{i=1}^n[g(X,Y_i)-g(X_{\epsilon},Y_i)]\right|}_{\leq \epsilon}  \\
&\quad +\left|\frac{1}{n}\sum_{i=1}^n g(X_{\epsilon},Y_i) - f(X_{\epsilon})\right|\\
&\quad + \underbrace{\left|f(X_{\epsilon})-f(X)\right|}_{\leq \epsilon} 
\end{align}
Taking a limit gives, with probability 1: 
$$ \limsup_{n\rightarrow\infty} \left|\frac{1}{n}\sum_{i=1}^n g(X,Y_i)-f(X)\right| \leq 2\epsilon $$
The above holds for all $\epsilon>0$, and the result follows. $\Box$
Claim 3:
The assumptions of Claim 2 hold whenever $\mathcal{Y}$ is a compact subset of $\mathbb{R}$ and $g:\mathbb{R}\times \mathcal{Y}\rightarrow \mathbb{R}$ is continuous. 
Proof: Write $\mathbb{R} = \cup_{i=-\infty}^{\infty} [i, i+1]$.  The function $g$ restricted to the compact domain $[i, i+1]\times \mathcal{Y}$ is continuous over this compact domain, and hence uniformly continuous over this compact domain.  Hence, it is uniformly continuous over each interval of the union of disjoint intervals $\cup_{i=-\infty}^{\infty} [i, i+1)$. $\Box$
