I have override the tax calculation module class "Magento\Tax\Model\Calculation" and pass the class in "\Magento\Checkout\Model\Cart" in constructor function as a dependency injection.
My requirement was to change the tax calculation when end user change to shipping method.therefor I used the class \Magento\Checkout\Model\Cart to get the shipping method name.
It was working and getting the shipping method when end user change from frontend and on the basis of shipping method name changing the logic to fulfill the requirement.
Now when click on button Place Order to make the order I am getting below error.
"infinite loop detected review the trace for the looping path" .
Can anybody have idea why this error occurring and what's the other way to get the shipping method in tax calculation class.
I have tried many methods but not getting any work.Please help.
Below is the reference what I did.