I have managed to figure out the reason for this issue. Hope this helps anyone facing this issue as this has taken more time to identify the root cause than the fix and it is happening only in release mode. The fix is a very small change and I strongly feel that UWP framework release mode error reporting should have been much better and developer friendly.
The issue is due to an extra forward slash in the path while reading the resource dictionary, crazy
The code that breaks in release mode
<ResourceDictionary Source="ms-appx:///CustomApp.Views//styles/CommandrStyles.xaml" />
Removing extra slash before styles path worked.
<ResourceDictionary Source="ms-appx:///CustomApp.Views/styles/CommandrStyles.xaml" />