Skip to content

Loading .NET library: CompilerInternalException if methods are present with optional parameter of type enum (2nd attempt) #13671

@MichaelBuehler

Description

@MichaelBuehler

If this issue is with Dynamo for Revit, please post your issue on the Dynamo for Revit Issues page.

If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.

Dynamo version

ALL up to 2.17

Operating system

Windows 10

What did you do?

Loading a dll into Dynamo Sandbox or Dynamo Revit.
The dynamo load library function will cause 'CompilerInternalException' error message if a method like this is present

myClass.AnyMethod(myCustomEnumType parameter = myCustomEnumType .None);
because "parameter" provides a default value of a custom type.
It looks like all dynamo versions are affected (I found in 2.12.0 but it appears also inside current 'main' code).

This is caused by the Dynamo code parsing the dll to generate nodes:

Engine\ProtoCore\FFI\CLRDLLModule
Method ParseArgumentSignature(MethodBase method)

This is caused by the Dynamo code parsing the dll to generate nodes:

Engine\ProtoCore\FFI\CLRDLLModule
Method ParseArgumentSignature(MethodBase method)
..
foreach (var parameter in parameter)
{
if (parameter.IsOptional
{
var defaultValue = = parameter.DefaultValue;
if (defaultValue != null)
{

var rhs = AstFactory.BuildPrimitiveNodeFromObject(defaultValue); // EXCEPTION

}
}
}

which calls

Engine/ProtoCore/Parser/AssociativeAST.cs
Method BuildPrimitiveNodeFromObject(object value)
where value must be of type short, int, long, float, double, string, boolan - otherwise it will throw exception.

What did you expect to see?

No error on loading a dll.

Also: If error a more meaningful error message would be helpful.
Currently: 'Exception of type 'ProtoCore.Exceptions.CompilerInternalException' was thrown

Including dll name + class name + method name (or at least dll name) would be extreme helpful

quite often errors can be caused due a dependency.. (version conflict for example). Which dependency?

What did you see instead?

A dialog 'Failed to load library'.

Metadata

Metadata

Assignees

Labels

Nodesdeveloper experiencemore high-level issues that are more specific to individuals actively developing on Dynamo.engineIssues related to the engine driving Dynamo.tracked

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions