Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPython3 - 'System.Reflection.Emit.TypeBuilder' was not found. #3008

Open
Cyril-Pop opened this issue Nov 15, 2023 · 7 comments
Open

CPython3 - 'System.Reflection.Emit.TypeBuilder' was not found. #3008

Cyril-Pop opened this issue Nov 15, 2023 · 7 comments
Labels

Comments

@Cyril-Pop
Copy link

Cyril-Pop commented Nov 15, 2023

Dynamo Version

Dynamo 2.19.3

Revit Version

Revit 2024.2

Operating System

Windows 11

What did you do?

try to use events subscription with CPython3

What did you expect to see?

No Error

What did you see instead?

a Python error

Node Name: PythonScript
Package: Core.Scripting
Dynamo Version: 2.19.3.6394
Host: Dynamo Revit
Messages: PythonEvaluator.Evaluate operation failed.
The constructor on type 'System.Reflection.Emit.TypeBuilder' was not found.
Status: Warning

image

Example 1

import clr
import System
from System import EventHandler

clr.AddReference("System.Drawing")
clr.AddReference("System.Windows.Forms")
import System.Drawing
import System.Windows.Forms

from System.Drawing import *
from System.Windows.Forms import *

class Form26(Form):
	def __init__(self):
		self.InitializeComponent()
	
	def InitializeComponent(self):
		self._button1 = System.Windows.Forms.Button()
		self.SuspendLayout()
		# 
		self._button1.Location = System.Drawing.Point(73, 103)
		self._button1.Name = "button1"
		self._button1.Size = System.Drawing.Size(142, 43)
		self._button1.TabIndex = 0
		self._button1.Text = "button1"
		self._button1.UseVisualStyleBackColor = True
		self._button1.Click += self.Button1Click
		# 
		self.ClientSize = System.Drawing.Size(284, 261)
		self.Controls.Add(self._button1)
		self.Name = "Form26"
		self.Text = "Form26"
		self.ResumeLayout(False)

	def Button1Click(self, sender, e):
		pass
  
objForm = Form26()
objForm.ShowDialog()

Example 2

import clr
import System
from System import EventHandler

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *
from Autodesk.Revit.UI.Events import *

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
uiapp = uidoc.Application

def dismiss (sender, eventArgs):
    if isinstance(eventArgs, TaskDialogShowingEventArgs):
        eventArgs.OverrideResult(TaskDialogResult.No)
    return

dialogEventHandler = EventHandler[DialogBoxShowingEventArgs](dismiss)

uiapp.DialogBoxShowing += dialogEventHandler

Stacktrace/logs

No response

Details

the error seems related to the build/compilation of PythonNet 2.5.2 (Python.Runtime) with Net.Standard 2.0 as target

there are potentially others PythonNet 2.5.2 issues due to this change (Net Framework -> Net.Standard 2.0),
will probably be resolved in PythonNet 3.x.x

@Cyril-Pop
Copy link
Author

Related issue
DynamoDS/Dynamo#14612

@AhmadEltobshy
Copy link

no updates ?

i have faced the same issue
image

@Amoursol
Copy link
Contributor

@Cyril-Pop @AhmadEltobshy We have plans to update the PythonNET bridge project as per our roadmap that should resolve a lot of CPython parity issues with IronPython. We're not yet sure of the full extent, but it should be significantly better than today.

@Cyril-Pop
Copy link
Author

Cyril-Pop commented Apr 21, 2024

@Amoursol
Do you have an approximate date for the integration of PythonNet 3?

@Amoursol
Copy link
Contributor

@Amoursol Do you have an approximate date for the integration of PythonNet 3?

@Cyril-Pop unfortunately no, the one thing we really cannot do is give out dates. What I can say is that we are in planning phase and active work will start on the 1st May and are committed to enhancing the CPython experience as much as we can within the bounds of resourcing, time and other commitments. It's the top of our priority list for Q2 (May - July).

@diegojsanchez
Copy link

I have exactly the same problem with Civil 3D 2024.3. I also create a Form class. I will be praying for it to fix between May and July. Thank you for the information.

@pak9819
Copy link

pak9819 commented May 24, 2024

I have the same error when using winforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Triage
Development

No branches or pull requests

6 participants