Let $$\Sigma$$ be a compact surface with boundary $$\partial \Sigma$$. Fix a Riemannian metric on $$\Sigma$$ and let $$D \in \Omega^1(SO(\Sigma),\mathfrak{o}(2) )$$ be a principal connection on the associated oriented orthonormal frame bundle $$p:SO(T\Sigma) \to \Sigma$$. There exists a unique $$\Omega \in \Omega^2(\Sigma)$$ such that $$p^* \Omega = \text{Pf}(\text{Curv}_D)$$, the Pfaffian of the curvature form (up to some constant involving $$\pi$$ which I ignore). Let $$\pi_0 : S(T\Sigma) \to \Sigma$$ be the unit sphere bundle with $$N: \partial \Sigma \to S(T \Sigma)$$ the unit normal and let $$\Phi \in \Omega^1(S(T\Sigma))$$ satisfy $$d \Phi = \pi_0^* \Omega$$. Then the Chern-Gauss-Bonnet theorem for manifolds with boundary says:

$$\int_{\partial \Sigma}N^*\Phi = \int_{\Sigma} \Omega - \chi(\Sigma).$$

$$T\Sigma$$ is a trivial bundle so $$SO(T\Sigma)$$ is a trivial principal $$SO(2)$$-bundle so pick the canonical flat connection $$A=\theta^L =g^{-1}dg$$ on $$\Sigma \times SO(2)$$ (i.e. the left-invariant Maurer-Cartan form). The curvature of $$A$$ is $$0$$ so the Pfaffian of the curvature of $$A$$ is $$0$$ hence $$\Omega=0$$ and $$\Phi=0$$. Putting this into the Chern-Gauss-Bonnet theorem we conclude $$\chi(\Sigma)=0$$ which is certainly not true for all $$\Sigma$$.

• With a flat metric on $\Sigma$, the geodesic curvature integral on $\partial\Sigma$ will most definitely not be $0$. Oct 6, 2022 at 18:15
• Why is $T\Sigma$ a trivial bundle? Oct 6, 2022 at 23:01
• @Andreas That's a good question to ask! It hinges on $2$-dimensional manifold with (non-empty) boundary. Oct 6, 2022 at 23:04
• @Math: please do not delete your question after others have spent time and effort helping you. Others can benefit from their answers, as well.
– robjohn
Oct 7, 2022 at 2:23

As I commented, when you put a flat metric on $$\Sigma$$, the geodesic curvature integral on $$\partial\Sigma$$ will definitely not vanish. (Think about classical Gauss-Bonnet for planar regions.)
Your claim that $$T\Sigma$$ is trivial may not be obvious to everyone. But you can put a nowhere-zero vector field on a manifold with nonempty boundary (for example, double the manifold, take a generic vector field, and then move its zeroes to "the other half"). On a (Riemannian) surface, once you have a nowhere-zero vector field, rotating it $$\pi/2$$ gives another, and so you've trivialized the tangent bundle.