IronLanguages / IronLanguages/ironpython3

Unhelpful/misleading error message when inporting fails due to missing dependency

Open
#1,859 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

Prerequisites
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?
Description

Importing fails in scenarios where a base class exposes a virtual properties that is in a nuget package and the library was built but not published.

This occurs even if that property is marked [CLSCompliant(false)].

The class that exposes that property often will import just fine, and some but not all classes that derive from it will import successfully. I've yet to decipher the pattern.

The main issue is that the error message does not identify with useful information what is wrong. It simply cannot import the type exposing the property.

Steps to Reproduce
  1. In C#, create a (generic?) class that exposes a public virtual property with type that comes from a nuget package.
  2. Derive from this class a (non-generic?) child class
  3. Build your solution
  4. Link IronPython to the resulting DLL
  5. Try to import the type in IronPython

Expected behavior:

  1. ipy identifies the dependency on a nuget package (potentially not technically possible) OR
  2. ipy produces a meaningful error that states the type exposed by the property cannot be found

Actual behavior:

A non-helpful error message that it cannot import one or more classes deriving from the base class that exposes the property

Work around / Solution

Publish the C# DLL, don't just build it. This should have been done in the first place - my error - but ipy gives such an unhelpful error message that it has cost a lot of development time to discover the issue.

Version Information

IronPython 3.4.2 (3.4.2.1000)
[.NETCoreApp,Version=v8.0 on .NET 8.0.11 (64-bit)]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the described C# base and derived classes, a missing NuGet dependency, and an IronPython import of the built DLL. Trace the resulting import error to determine whether the missing exposed type can be identified; done means the error clearly names the unavailable dependency or exposed type.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.