Questions about Integrate function


I’d like to compute some integrals on the faces of each element in 2D and use them as the error estimator.

I found that the following two lines of code give different results.

sum( Integrate(CoefficientFunction(1)*dx(element_boundary=True), my_mesh,element_wise = True))

I am wondering why they are different. The NGSolve version I am using is 6.2.2007. I also attached my code.

I am also wondering if I want to compute integrals on all the faces of one element, including those are on the boundary, what is the right way to do it. The above code seems to ignore the boundary faces.

Thank you!