If I understand correctly, you have authored this class in C#, and are using it from C++/CLI.
You are correct that C++/CLI will automatically call Dispose
for you--but that's only if the class you are dealing with implements IDisposable
. In your case, your class does not implement IDisposable
, and thus, Dispose
in this case is just a normal method.
Change your class as follows:
public sealed class CLoadingScope : IDisposable