Criterion for being reflexive via Ext

Edit. Hailong Dao points out a serious error in what I originally wrote. I have edited the statement below. Unfortunately, the corrected condition on the Ext modules is now rather complicated: a dimension condition on the support of every Ext module, not just vanishing of the final two Ext modules.

I am just writing my comments as an answer. Edit. For a normal Noetherian integral domain $A$ and for a torsion-free, finitely generated $A$-module $N$, $N$ is reflexive if and only if, for every prime ideal $\mathfrak{p}\subset A$ of height $\geq 2$, for the local Noetherian ring $R=A_{\mathfrak{p}}, \mathfrak{m}= \mathfrak{p}A_{\mathfrak{p}}$ and for the localized module $M=N\otimes_A A_{\mathfrak{p}}$, the depth of $M$ is $\geq 2$ as an $R$-module. For a local Noetherian ring $(R,\mathfrak{m})$ of dimension $\geq 2$ (Edit: that is normal), for a finitely generated $R$-module $M$ (Edit: that is torsion-free), $M$ is "reflexive" in the usual sense if and only if the depth of $M$ is $\geq 2$. Also, the depth is $\geq 2$ if and only if the local cohomology groups $H_{\mathfrak{m}}^i(M)$ are zero for $i=0,1$. One reference is the exercises part of Section II.3, pp. 216-218, of Hartshorne's "Algebraic Geometry". If $(R,\mathfrak{m})$ is a regular local ring of dimension $d$, then those local cohomology groups are dual (in the sense of local duality theory) to the Ext groups $\text{Ext}^{d-i}_R(M,R).$ This is Corollary V.6.8, p. 276, and the comments at the end of the section, p. 281, of Hartshorne's "Residues and Duality", cf. also 6.3 of "Local Cohomology". Thus, in the regular case, $M$ is reflexive if and only if both $\text{Ext}^{d-1}_R(M,R)$ and $\text{Ext}^d_R(M,R)$ are zero.

Edit. Corrected Necessary and Sufficient Ext Condition. Assuming that $A$ is a regular Noetherian integral domain (so that also each localization $R$ is regular by Serre), this becomes a condition in terms of the Ext modules of the original module $N$ over the original ring $A$. A torsion-free, finitely generated module $N$ is reflexive if and only if, for every integer $e\geq 1$, every minimal associated prime of $\text{Ext}^e_A(N,A)$ has height $\geq e+2$, i.e., the support of the module has codimension $\geq e+2$. For example, when $A$ is regular of dimension $2$, this is equivalent to saying that $N$ is projective. When $A$ is regular of dimension $d \geq 2$, this condition implies that both $\text{Ext}^d_A(N,A)$ and $\text{Ext}^{d-1}_A(N,A)$ are zero, but vanishing of these Ext modules is not sufficient.

Having explained that the wrong statement in that previous post seems to have just been a transcription problem (Edit. Hailong Dao points out that it is more complicated than I thought), it is straightforward to construct examples of modules $M$ that are not reflexive where $\text{Ext}^1_R(M,R)$ and $\text{Ext}^2_R(M,R)$ are zero. Of course we need to choose $d>2$. For $d\geq 4$, the maximal ideal $M=\langle x_1,\dots,x_d \rangle$ in $k[x_1,\dots,x_d]$ has vanishing $\text{Ext}^1_R(M,R)$ and $\text{Ext}^2_R(M,R)$, yet $M$ is not reflexive.


About the last question, I should point out that there is indeed a Ext-vanishing criterion for reflexivity. Namely, $M$ is reflexive iff $Ext^{1,2}(Tr(M),R)=0$ where $Tr(M)$ is the Auslander-Bridger transpose of $M$. For details see for instance Lemma 2.2 in this paper: https://arxiv.org/pdf/0809.1958v3.pdf