dotnet / dotnet/roslyn

GetReferencesForCompilation Problem in Android

Open
#77,966 0 comments 0 reactions 0 assignees View on GitHub
Area-Interactive Bug
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

```
var corLib = MetadataReference.CreateFromAssemblyInternal(typeof(object).GetTypeInfo().Assembly);
references.Add(corLib);
```
I found codes in class CodeAnalysis.Scripting.Script.It looks to provide a default assembly metadata reference.However, It cause a error in Android because the assembly is in the .apk file.

The mistake was like
```
Could not find a part of the path "/data/app/…………/mscorlib.dll"
```
I found issues #23537 , #24442.I think it is the same problem

I've tried using other methods to read the assemblies I need, but I can't get around here.

I think there should be a way to provide the metadata reference by myelf.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting CodeAnalysis.Scripting.Script.It and the MetadataReference.CreateFromAssemblyInternal call shown in the report, then compare the related issues #23537 and #24442. Done means scripting can obtain the required default assembly metadata reference on Android without trying to read mscorlib.dll from an APK path.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
compilers, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.