|I created a simple WinRT C++ class to help having meaningful exception, it looks like that
public enum class ErrorCodes
CodeStart = 0x0200, CodeEnd = CodeStart + 100, NotErrorCode = CodeEnd - 1,
StupideError1 = CodeStart + 1,
StupideError2 = CodeStart + 2,
public ref class Class1 sealed
static void Throw(ErrorCodes c);
static ErrorCodes GetCode(Platform::Exception^ ex);
However, when I try to use it in C#, with code like that
catch (Exception ex)
var c = Class1.GetCode(ex);
I got the following compiler error in my C# project:
2>C:\Dev\W8\App1\App1\App.xaml.cs(42,5,42,8): error CS0012: The type 'Platform.Exception' is defined in an assembly that is not referenced. You must add a reference to assembly 'platform, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
2>C:\Dev\W8\App1\App1\App.xaml.cs(42,13,42,31): error CS1502: The best overloaded method match for 'CppComp.Class1.GetCode(Platform.Exception)' has some invalid arguments
2>C:\Dev\W8\App1\App1\App.xaml.cs(42,28,42,30): error CS1503: Argument 1: cannot convert from 'System.Exception' to 'Platform.Exception'
How could I fix that?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
My programs never have bugs, they just develop random features.