I got my initial code working on the C DLL and it's creating snapshot sets as I 
want.  I am now having a problem with a function to query ALL the snapshots.

This value can be sent to SetContext()
In [39]: alphavsslib.VssSnapshotContext.All
Out[39]: 4294967295

4294967295 = 0xFFFFFFFF

A sample of the call is here:
https://github.com/alphaleonis/AlphaVSS-Samples/blob/8482e83dd13cb8467860e8be199d265963aa6ab8/src/SnapshotQuery/Program.cs

# this is the declaration of SetContext
virtual void SetContext(VssSnapshotContext context);

This is the declaration for All:   VssSnapshotContext.All = 0xFFFFFFFF
https://github.com/alphaleonis/AlphaVSS/blob/13462e657f7993da5c80f835d219bbe82079ce75/src/AlphaVSS.Common/Enumerations/VssSnapshotContext.cs#L58

However, this line results in a Type error

In [40]: ctx = cmp.SetContext(alphavsslib.VssSnapshotContext.All)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [40], in <cell line: 1>()
----> 1 ctx = cmp.SetContext(alphavsslib.VssSnapshotContext.All)

TypeError: No method matches given arguments for SetContext: (<class 'int'>)


I've tried converting the value using:

ctx = 
cmp.SetContext(System.Convert.ToUInt32(alphavsslib.VssSnapshotContext.All))

*And*
ctx = cmp.SetContext(ctypes.c_uint32(alphavsslib.VssSnapshotContext.All).value)

but the same error occurs

I can get the function to succeed (albeit it doesn't show me what I want) with 
this:

cmp.SetContext(ctypes.c_int32(alphavsslib.VssSnapshotContext.All).value)

... because ctypes.c_int32(alphavsslib.VssSnapshotContext.All).value = -1

I believe it's possible that this could be related to the link below but I 
can't be sure because I am not a C developer and I can't determine how this was 
fix from the notes in the link.

Granted, the author is on CentOS, and I'm on Windows... but the backstory 
behind the issue sounds like it's related.

https://github.com/pythonnet/pythonnet/issues/950

I'm currently running on pythonnet 2.5.2 and
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit 
(AMD64)] on win32

Any thoughts or suggestions would be greatly appreciated.

Steven
_______________________________________________
PythonNet mailing list -- pythonnet@python.org
To unsubscribe send an email to pythonnet-le...@python.org
https://mail.python.org/mailman3/lists/pythonnet.python.org/
Member address: arch...@mail-archive.com

Reply via email to