Bug 42787 - C7SR1 netstandard fixes break roslyn: type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception
Summary: C7SR1 netstandard fixes break roslyn: type initializer for 'Microsoft.CodeAna...
Status: VERIFIED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: General ()
Version: 4.4.0 (C7)
Hardware: PC All
: --- normal
Target Milestone: (C7SR1)
Assignee: Alexander Köplinger [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2016-07-25 15:32 UTC by Alexander Köplinger [MSFT]
Modified: 2016-07-26 14:20 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: Yes
Last known good build: C7 baseline

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Alexander Köplinger [MSFT] 2016-07-25 15:32:33 UTC
The netstandard wave1 work we did in C7SR1 breaks compilation with roslyn.

Repro steps:

1. Create new file Program.cs with:

> using System;
> 
> public class Program
> {
> 	public static void Main ()
> 	{
> 		Console.WriteLine ("Hello World");
> 	}
> }

2. nuget install Microsoft.Net.Compilers -Version 1.3.2
3. mono Microsoft.Net.Compilers.1.3.2/tools/csc.exe Program.cs

It fails with:

> Microsoft (R) Visual C# Compiler version 1.3.1.60621
> Copyright (C) Microsoft Corporation. All rights reserved.
> 
> error CS1504: Source file '/Users/alexander/Desktop/roslyn-bug/Program.cs' could not be opened -- The type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception.
Comment 1 Alexander Köplinger [MSFT] 2016-07-25 15:33:40 UTC
Fixed with mono master/398320339ca70efdc3c92349a985e73d5a9013fd and mono-4.4.0-branch-c7sr1/43c7daff3987c89dae36bae21ab88779cfdb0340
Comment 2 Rustam Zaitov 2016-07-26 13:58:06 UTC
with build from branch c7sr1/43c7 I got another error:

rzaitov:~/Downloads/bug42787$ mono  Microsoft.Net.Compilers.1.3.2/tools/csc.exe Program.cs
Microsoft (R) Visual C# Compiler version 1.3.1.60621
Copyright (C) Microsoft Corporation. All rights reserved.

error CS0006: Metadata file 'System.Deployment.dll' could not be found
error CS0006: Metadata file 'System.Web.Mobile.dll' could not be found
error CS0006: Metadata file 'System.Web.RegularExpressions.dll' could not be found
error CS0006: Metadata file 'System.Workflow.Activities.dll' could not be found
error CS0006: Metadata file 'System.Workflow.ComponentModel.dll' could not be found
error CS0006: Metadata file 'System.Workflow.Runtime.dll' could not be found

I will test this with build from master
Comment 3 Alexander Köplinger [MSFT] 2016-07-26 14:17:58 UTC
That's expected, those new assemblies (which csc.exe references by default) were added in C8/master: https://github.com/mono/mono/commit/11640a9e733362fb0a676b8d2b9c08ef2dd8ff8c. They are just dummy assemblies so are not actually used, I only tried the fix with C8 so I didn't notice that, sorry.

In C7SR1 you can pass /noconfig /r:System.dll additionally and it should work after the fix.
Comment 4 Rustam Zaitov 2016-07-26 14:20:55 UTC
Thx for your clarification here.
Build from master works.
Build from C7sr1 works also with /noconfig /r:System.dll