Improved concurrency handling in BuildSession.cs