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
There is an issue when trying to generate stubs for target runtimes > .net 6. See the output before for the .net 8 case.
According to dotnet/sdk#9917 it seems like a tool has to have a single fixed framework version. I wonder if it makes sense to update to .net 8 now as that should allow stub generation for .net 8 and below. It would mean whoever currently uses it will need to ensure they also have .net 8, but I think it is worth it for the future of the project.
error: failed generating stubs | Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at PythonNetStubGenerator.StubBuilder.BuildAssemblyStubs(DirectoryInfo destPath, FileInfo[] targetAssemblyPaths, DirectoryInfo[] searchPaths) in C:\Repos\pythonnet-stub-generator\csharp\PythonNetStubGenerator\StubBuilder.cs:line 30
at PythonNetStubTool.Program.Main(DirectoryInfo destPath, String targetDlls, DirectoryInfo[] searchPaths) in C:\Repos\pythonnet-stub-generator\csharp\PythonNetStubTool\Program.cs:line 42
The text was updated successfully, but these errors were encountered:
Yes, I think it's worth updating the tool to .NET 8.
Technically, any user should work as long as the TFM of the target library works with .net8.
The tool itself can be of a higher TFM than the project it was used in.
(e.g. I mainly used this in unity which is a 4.5 offshoot)
I think this outlines a major implementation issue with the way this tool works in that it loads the assembly of the dll that it is targeting. This means that the TFM of the loaded assembly needs to be a subset of the TFM of the tool. See here for more info: https://learn.microsoft.com/en-us/dotnet/standard/frameworks#net-5-os-specific-tfms
This means that this tool has almost no chance of supporting OS-Specific TFMs without it being rebuilt from source.
I think there's two ways to ameliorate the situation long-term:
move the logic into an assembly that is called into by a configurable entry point that loaded the appropriate frameworks.
It may have been a better idea to use some sort of metadata extraction process that avoids loading the assembly.
If I'm able to find some help, I will look either of these. (Likely for a V2)
In the meantime, I will check to see if there are any problems with the upgrade and publish a new version. I'm a bit busy at the moment, so it might be a week or two.
There is an issue when trying to generate stubs for target runtimes > .net 6. See the output before for the .net 8 case.
According to dotnet/sdk#9917 it seems like a tool has to have a single fixed framework version. I wonder if it makes sense to update to .net 8 now as that should allow stub generation for .net 8 and below. It would mean whoever currently uses it will need to ensure they also have .net 8, but I think it is worth it for the future of the project.
The text was updated successfully, but these errors were encountered: