Skip to content

CS0281 error message has less details than native compiler #17322

@marek-safar

Description

@marek-safar

Version Used: 2.0.0.61404

Steps to Reproduce:

Compile attached dll with the code as following

csc /out:cs0281.exe cs0281.cs -r:CSFriendAssembly-lib.dll

cs0281.cs

using System;

public class Test
{
	static void Main ()
	{
		FriendClass.MyMethod ();
	}
}

Expected Behavior:

Previous versions of C# compiler reported

CSFriendAssembly-lib.dll: error CS0281: Friend access was granted to 'cs0281,PublicKey=0024000004800000940000000602000000240000525341310004000011000000e39d99616f48cf7d6d59f345e485e713e89b8b1265a31b1a393e9894ee3fbddaf382dcaf4083dc31ee7a40a2a25c69c6d019fba9f37ec17fd680e4f6fe3b5305f71ae9e494e3501d92508c2e98ca1e22991a217aa8ce259c9882ffdfff4fbc6fa5e6660a8ff951cd94ed011e5633651b64e8f4522519b6ec84921ee22e4840e8', but the output assembly is named 'cs0281, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Try adding a reference to 'cs0281,PublicKey=0024000004800000940000000602000000240000525341310004000011000000e39d99616f48cf7d6d59f345e485e713e89b8b1265a31b1a393e9894ee3fbddaf382dcaf4083dc31ee7a40a2a25c69c6d019fba9f37ec17fd680e4f6fe3b5305f71ae9e494e3501d92508c2e98ca1e22991a217aa8ce259c9882ffdfff4fbc6fa5e6660a8ff951cd94ed011e5633651b64e8f4522519b6ec84921ee22e4840e8' or changing the output assembly name to match.

Actual Behavior:

cs0281.cs(11,15): error CS0122: 'FriendClass.MyMethod()' is inaccessible due to its protection level

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions