Comments (13)
If you don't mind I'll re-open the issue since this is technically a regression. I'm thinking a try/catch of NotImplementedException
would do the trick (although not sure how I'd go about testing it)...
private TryGetProperty TryGetByJit(MethodInfo method) {
try {
return method.DeclaringType!.IsAssignableFrom(typeof(TSelfType))
? TryGetByJitWithoutCast(method)
: TryGetByJitRequiringCast(method);
} catch (NotImplementedException) { // Mono can throw this...
return TryGetByReflection;
}
}
from ironpython3.
Cannot reproduce, the Python sample is incomplete. What are arguments to set_generated_rules
? Which version of .NET are you using?
from ironpython3.
Cannot reproduce, the Python sample is incomplete.
I'm not sure what you mean. That's the exact script I've been running that has the issue for me.
What are arguments to
set_generated_rules
?
I'm not actually calling set_generated_rules
at any point yet, that's the next step. I'm just calling compiled.Execute()
so I can attach the script to the scope
so I can then get the function out to call it later (if there's an easier way to do that let me know, but I couldn't find one).
Which version of .NET are you using?
I'm using .NET 4.7.2.
from ironpython3.
OK, it wasn't clear to me at which place you were getting the exception. As I understand it now, it is compiled.Execute(scope);
and not when calling set_generated_rules
. Still, I cannot reproduce your issue. I tried .NET Framework 4.8 and .NET 6.0 — the script, as it is, executes just fine.
On a side note, your script uses TRUE
rather than True
? This variable will be undefined unless you define it explicitly before calling set_generated_rules
if you get that far (though it should not have any consequence on the problem you are facing now).
I'm using .NET 4.7.2.
Not using Mono? Strange that I see System.Reflection.MonoMethod.Invoke
in the stack trace.
from ironpython3.
OK, it wasn't clear to me at which place you were getting the exception. As I understand it now, it is
compiled.Execute(scope);
and not when callingset_generated_rules
.
Correct, sorry I didn't make that clear at first.
Still, I cannot reproduce your issue. I tried .NET Framework 4.8 and .NET 6.0 — the script, as it is, executes just fine.
Huh. Weird. I'll do some more digging to try to find a better MRE.
On a side note, your script uses
TRUE
rather thanTrue
? This variable will be undefined unless you define it explicitly before callingset_generated_rules
if you get that far (though it should not have any consequence on the problem you are facing now).
Good to know. I don't know python. That being said I'm sourcing the final script from elsewhere, so I'm not too concerned if my test script doesn't work 100%.
Not using Mono? Strange that I see
System.Reflection.MonoMethod.Invoke
in the stack trace.
I'll be honest, I have no idea. I'm not a C# dev, I'm just trying to make a mod for a Unity game. All I know is my .csproj
says <TargetFramework>net472</TargetFramework>
.
from ironpython3.
Ah, Unity… Just to make sure: are you running your mod on Unity on a desktop platform? If so, which one? Windows, macOS, UWP, Linux?
The "TargetFramework" moniker in .csproj
specifies the .NET API, not necessarily the .NET platform. net472
means it is either .NET Framework or Mono. If you run on something else than Windows, then for sure it's Mono. Unfortunately, Mono does not implement the complete .NET API. Sometimes workarounds are possible.
from ironpython3.
I'm developing the mod on Windows, but the game itself (Hollow Knight) is cross platform. Also, after doing some more digging through the project setup I see references to Mono.Cecil
, so I'm pretty sure it's Mono.
That being said, I don't understand why Mono would be a problem here. The error being thrown looks like a missing/bugged IronPython language feature error to me (but one I can't find where it's thrown from), not a .NET vs Mono error. Though admittedly I know almost no C#, so it's possible I'm overlooking something.
from ironpython3.
It does look like a something in Mono not being fully implemented in the version of Mono you are using. I have found a similar report in mono/mono#21534. This issue is still open, however I was able to run your example without problems with Mono v6.12 on Linux, so maybe it got implemented anyway and you are simply using an old Mono version.
I haven't worked on any Unity mod before, so I don't know anything about Unity toolset, but if it is possible, I'd recommend to migrate your mod project to .NET 6.0 or later. If you point me to some resources on Unity mod development in C#, I might be able to look into it (I have Unity on Windows installed).
from ironpython3.
Ah, I see. Well that's a shame. Unfortunately I don't think I have a way to adjust the Mono version used. I'm merely creating a dll that is then loaded by a Unity game outside of my control. I'll keep poking around though, see if there's some other solution I can find.
from ironpython3.
@thislooksfun Does your code fail with v3.4.0? You're hitting a code path that was recently modified for performance (#1706) so if v3.4.0 works it might be possible to change some stuff to make it work again...
from ironpython3.
It does! Thank you!
However I now have a new problem in that now calling scope.GetVariable()
is throwing System.TypeLoadException: Failure has occurred while loading a type.
, but that feels like a problem with my code rather than the library.
from ironpython3.
not sure how I'd go about testing it
.NET is being tested by several test runs on all supported versions, maybe something similar for Mono: one test run on the latest Mono version and one on the oldest that we support (though I don't know which one that is).
from ironpython3.
Well in theory the ".NET Framework" tests on Linux/macOS are Mono. Not sure which version, but I'm assuming they're on 6.12.something as that's the latest? As for the oldest that we should support probably depends on whats bundled with Unity as that appears to popular among users.
from ironpython3.
Related Issues (20)
- trailing characters in format string should raise ValueError
- Import termios not loading on Linux from Iron Python HOT 2
- PYTHON environment variables are ignored
- PEP 540 – Add a new UTF-8 Mode
- Use _strptime for datetime parsing
- PythonOps.ScopeTryGetMember is really slow
- IronPython Installer HOT 1
- When Windows RDP Connected, Application will be Noresponse HOT 1
- Testing the IronPython C# code with LinqPad5 does not print any output HOT 1
- Memory leak when calling list(...) on OrderedDict HOT 2
- Confusion between class variable and instance variable when descriptor is used HOT 1
- Debugging IronPython packages
- GC related tests failing on Mono
- Different behaviour of simple script when compiled HOT 2
- MSSQL support in IronPython 3.4 HOT 5
- ImportException: IronPython3 NET HOT 1
- Ipyc not including json in standalone executable HOT 4
- no package installation possible
- Using IronPython shell from GNU Emacs doesn't work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ironpython3.