xamarin/Xamarin.Forms

Errors when inheriting from any class in a local NET Standard library project.

Open

#4,280 opened on Nov 1, 2018

 (1 comment) (1 reaction) (0 assignees)C# (1,926 forks)batch import
e/2 :clock2:good first issuehelp wantedi/lowinactivep/UWPt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

Errors result when inheriting from any class in a referenced local project.

Steps to Reproduce

  1. Create a .NET Standard library project (I name it Commons.Forms).
  2. Create any class inside that project.
  3. In a Xamarin Forms cross-platform project (MyProject), add Commons.Forms project in the solution then reference it in MyProject.
  4. Create a class inside MyProject inheriting from the class in step 2.
  5. Run MyProject.UWP

Expected Behavior

No errors.

Actual Behavior

If MyProject was not built before (or if it was cleaned), a build/compilation error occurs:

Severity	Code	Description	Project	Project Rank	Path	File	Line	Column	Category	Source	Suppression State	Tool
Error		Could not copy the file "obj\x86\Debug\MainPage.xbf" because it was not found.	Prayer.UWP	4						Build		
Error		Could not copy the file "obj\x86\Debug\App.xbf" because it was not found.	Prayer.UWP	4						Build		
Error		Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: Commons.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.'	Prayer.UWP	4	{PATH_HERE}\MyProject.UWP.csproj				Build		

If MyProject was successfully built before (like when it is was previously built before the bug is introduced), a runtime error occurs on Xamarin.Forms.Forms.Init(e):

System.Runtime.InteropServices.COMException: 'Error HRESULT E_FAIL has been returned from a call to a COM component.'

Basic Information

  • Version with issue: tested both 3.1 and 3.3
  • Last known good version: ?
  • IDE: VS 15.8.7
  • Platform Target Frameworks:
    • iOS: haven't tested yet
    • Android: haven't tested yet
    • UWP: latest Windows 10
  • Android Support Library Version:
  • Nuget Packages: barely added any (just starting learning Xamarin forms)
  • Affected Devices:

Contributor guide