ClangSharp icon indicating copy to clipboard operation
ClangSharp copied to clipboard

A non defined function macro being used results in a crash

Open ThadHouse opened this issue 4 years ago • 0 comments

#define ADDRESS_IN_USE TESTRESULT_FROM_WIN32(10048)

If TESTRESULT_FROM_WIN32 is not defined, the above code will result in the following stack trace.

System.InvalidCastException
  HResult=0x80004002
  Message=Unable to cast object of type 'ClangSharp.Stmt' to type 'ClangSharp.Expr'.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Runtime.CompilerServices.CastHelpers.ChkCastAny(Void* toTypeHnd, Object obj)
   at ClangSharp.TranslationUnit.GetOrCreate[TCursor](CXCursor handle) in C:\Users\thhous\Documents\GitHub\ClangSharp\sources\ClangSharp\TranslationUnit.cs:line 105
   at ClangSharp.VarDecl.<>c__DisplayClass4_0.<.ctor>b__1() in C:\Users\thhous\Documents\GitHub\ClangSharp\sources\ClangSharp\Cursors\Decls\VarDecl.cs:line 26
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)

ThadHouse avatar Mar 28 '21 06:03 ThadHouse