  Let $R$ be a commutative Noetherian ring with non-zero identity,
$\mathfrak{a}$ and ideal of $R$, $M$ a finite $R$--module, and $n$ a
non-negative integer. In this paper, for an arbitrary $R$--module $X$ which is
not necessarily finite, we study the finiteness dimension $f_\mathfrak{a}(M,X)$
and the $n$-th finiteness dimension $f^n_\mathfrak{a}(M,X)$ of $M$ and $X$ with
respect to $\mathfrak{a}$. Assume that
$\operatorname{Ext}^{i}_{R}(R/\mathfrak{a},X)$ is finite for all $i\leq
f^2_\mathfrak{a}(M,X)$ (resp. $i< f^1_\mathfrak{a}(M,X)$). We show that
$\operatorname{H}^{i}_{\mathfrak{a}}(M,X)$ is $\mathfrak{a}$--cofinite for all
$i< f^2_\mathfrak{a}(M,X)$ (resp. $i< f^1_\mathfrak{a}(M,X)$) and
$\operatorname{Ass}_{R}(\operatorname{H}^{f^2_\mathfrak{a}(M,X)}_{\mathfrak{a}}(M,X))$
(resp. if $\operatorname{Ext}^{f^1_\mathfrak{a}(M,X)}_{R}(R/\mathfrak{a},X)$ is
finite, then
$\operatorname{Ass}_{R}(\operatorname{H}^{f^1_\mathfrak{a}(M,X)}_{\mathfrak{a}}(M,X))$)
is finite.
