🌐 AI搜索 & 代理 主页
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Initialize gives a helpful message when the TypeOffset interop class …
…is not configured correctly
  • Loading branch information
tminka committed Dec 30, 2020
commit 8f66882e3abe91feeaf95819f242327c25fe143e
7 changes: 6 additions & 1 deletion src/runtime/native/ABI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ internal static void Initialize(Version version, BorrowedReference pyType)
thisAssembly.GetType(nativeTypeOffsetClassName, throwOnError: false)
?? thisAssembly.GetType(className, throwOnError: false);
if (typeOffsetsClass is null)
throw new NotSupportedException($"Python ABI v{version} is not supported");
{
var types = thisAssembly.GetTypes().Select(type => type.Name).Where(name => name.StartsWith("TypeOffset"));
string message = $"Searching for {className}, found {string.Join(",", types)}. " +
"If you are building Python.NET from source, make sure you have run 'python setup.py develop' to fill in configured.props";
throw new NotSupportedException($"Python ABI v{version} is not supported: {message}");
}
var typeOffsets = (ITypeOffsets)Activator.CreateInstance(typeOffsetsClass);
TypeOffset.Use(typeOffsets);

Expand Down