You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all I'm terrible at C++ and interop, so excuse me for any dumb remarks in this issue. I've used pinvoke.net before to use CopyFileEx in our code base. I tried replacing the dllimport with CsWin32. I ran into several issues.
The callback argument lpProgressRoutine is of type LPPROGRESS_ROUTINE. When opening the reference of CopyFileEx in Visual Studio after generating it by adding it to NativeMethods.txt the type LPPROGRESS_ROUTINE remains white and cannot be opened using Go To Definition. In addition to this Visual Studio was unable to generate a method for the callback routine using quick actions. The only option was to create a field/property/variable as type object. Finally I found out that Go To Definition does work when you write out the type in a C# file in source file.
The generated type LARGE_INTEGER cannot be casted to int making it impossible to make heads or tails from the progress values in the LPPROGRESS_ROUTINE calls.
The types LPVOID and LPBOOL are generated as void* and bool* correspondingly. Since these values aren't needed passing in null for both should work (should it?), but I was unable to use the argument types I was used to: IntPtr.Zero and a bool by ref.
The last problem is that enum values in the return type of LPPROGRESS_ROUTINE seem to be missing, for which I created the issue microsoft/win32metadata#170 in the win32metadata repository.
After messing around a bit it seems the CsWin32 source generator has stopped working entirely and even after a VS restart and NuGet uninstall/install it did not seem to want to generate any more code. I'm not sure what's going on and where to look for log files.
The text was updated successfully, but these errors were encountered:
Hi @wldevries. Thank you so much for giving this a try and for providing great feedback. I'm sorry your first experience wasn't better.
You've made several good points here. I will look more into them next week to see where we can improve. My goal is to provide you with a sample of how to make it work, and any fixes we may need to make here in order to make that happen.
Some of the issues you raised with the generator itself have been fixed. You can try them out in the daily build (see readme). Also, please try using VS from the Preview channel, as many fixes have been made to the IDE integration of Source Generators in VS 2019 Update 9.
First of all I'm terrible at C++ and interop, so excuse me for any dumb remarks in this issue. I've used pinvoke.net before to use
CopyFileEx
in our code base. I tried replacing the dllimport with CsWin32. I ran into several issues.The callback argument
lpProgressRoutine
is of typeLPPROGRESS_ROUTINE
. When opening the reference ofCopyFileEx
in Visual Studio after generating it by adding it to NativeMethods.txt the typeLPPROGRESS_ROUTINE
remains white and cannot be opened using Go To Definition. In addition to this Visual Studio was unable to generate a method for the callback routine using quick actions. The only option was to create a field/property/variable as type object. Finally I found out that Go To Definition does work when you write out the type in a C# file in source file.The generated type
LARGE_INTEGER
cannot be casted toint
making it impossible to make heads or tails from the progress values in theLPPROGRESS_ROUTINE
calls.The types
LPVOID
andLPBOOL
are generated asvoid*
andbool*
correspondingly. Since these values aren't needed passing in null for both should work (should it?), but I was unable to use the argument types I was used to:IntPtr.Zero
and abool
byref
.The last problem is that enum values in the return type of
LPPROGRESS_ROUTINE
seem to be missing, for which I created the issue microsoft/win32metadata#170 in the win32metadata repository.After messing around a bit it seems the CsWin32 source generator has stopped working entirely and even after a VS restart and NuGet uninstall/install it did not seem to want to generate any more code. I'm not sure what's going on and where to look for log files.
The text was updated successfully, but these errors were encountered: