Version Used:
Microsoft.Net.Compilers 2.0.1
Steps to Reproduce:
Expected Behavior:
Description says "Supported Platforms: - .NET Framework 4.6" so developer does not attempt step 3.
Actual Behavior:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: The "Csc" task could not be instantiated from "REDACTED\packages\Microsoft.Net.Compilers.2.0.1\build\..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll". [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: System.TypeInitializationException: The type initializer for 'Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.CodeAnalysis.BuildTasks.AssemblyResolution' threw an exception. ---> System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'. [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: at Roslyn.Utilities.CorLightup.Desktop.GetCurrentAppDomain() [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: at Roslyn.Utilities.CorLightup.Desktop.GetOrRemoveAssemblyResolveHandler(Func`3 handler, MethodInfo handlerOperation) [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: --- End of inner exception stack trace --- [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: at Microsoft.CodeAnalysis.BuildTasks.AssemblyResolution.Install() [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: --- End of inner exception stack trace --- [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4061: at Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler..ctor() [REDACTED\REDACTED.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4060: The "Csc" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. [REDACTED\REDACTED.csproj]
FYI @jaredpar @agocke
@agocke Assigning this to you as it seems the other bug mentioned in your PR is currently closed. Feel free to dupe if you have another tracking bug.
Might be an unrelated bug, but does it actually require 4.6.1? Getting weird EntryPointNotFoundException on build server with 4.6, but not on local with 4.6.1 (unfortunately don't have the full trace at the moment, but top was something weird like IReadOnlyCollection<T>.get_Count).
Going to install 4.6.1 on build server tomorrow, and see if that helps.
Can confirm installing 4.6.1 fixes the issue, so the requirement should be 4.6.1, not 4.6.
Here is the stack trace when it's 4.6:
System.EntryPointNotFoundException: Entry point was not found.
at System.Collections.Generic.IReadOnlyCollection`1.get_Count()
at Microsoft.CodeAnalysis.CSharp.Binder.IsDegenerateQuery(QueryTranslationState state)
at Microsoft.CodeAnalysis.CSharp.Binder.BindQuery(QueryExpressionSyntax node, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindLambdaExpressionAsBlock(ExpressionSyntax body, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.UnboundLambdaState.ReallyBind(NamedTypeSymbol delegateType)
at Microsoft.CodeAnalysis.CSharp.UnboundLambdaState.Bind(NamedTypeSymbol delegateType)
at Microsoft.CodeAnalysis.CSharp.ConversionsBase.IsAnonymousFunctionCompatibleWithDelegate(UnboundLambda anonymousFunction, TypeSymbol type)
at Microsoft.CodeAnalysis.CSharp.ConversionsBase.IsAnonymousFunctionCompatibleWithExpressionTree(UnboundLambda anonymousFunction, NamedTypeSymbol type)
at Microsoft.CodeAnalysis.CSharp.ConversionsBase.HasAnonymousFunctionConversion(BoundExpression source, TypeSymbol destination)
at Microsoft.CodeAnalysis.CSharp.ConversionsBase.ClassifyImplicitBuiltInConversionFromExpression(BoundExpression sourceExpression, TypeSymbol source, TypeSymbol destination, HashSet`1& useSiteDiagnostics)
at Microsoft.CodeAnalysis.CSharp.ConversionsBase.ClassifyImplicitConversionFromExpression(BoundExpression sourceExpression, TypeSymbol destination, HashSet`1& useSiteDiagnostics)
at Microsoft.CodeAnalysis.CSharp.OverloadResolution.IsApplicable(Symbol candidate, EffectiveParameters parameters, AnalyzedArguments arguments, ImmutableArray`1 argsToParameters, Boolean isVararg, Boolean hasAnyRefOmittedArgument, Boolean ignoreOpenTypes, HashSet`1& useSiteDiagnostics)
at Microsoft.CodeAnalysis.CSharp.OverloadResolution.IsApplicable[TMember](TMember member, TMember leastOverriddenMember, ArrayBuilder`1 typeArgumentsBuilder, AnalyzedArguments arguments, EffectiveParameters originalEffectiveParameters, EffectiveParameters constructedEffectiveParameters, ImmutableArray`1 argsToParamsMap, Boolean hasAnyRefOmittedArgument, HashSet`1& useSiteDiagnostics, Boolean inferWithDynamic)
at Microsoft.CodeAnalysis.CSharp.OverloadResolution.IsMemberApplicableInNormalForm[TMember](TMember member, TMember leastOverriddenMember, ArrayBuilder`1 typeArguments, AnalyzedArguments arguments, Boolean isMethodGroupConversion, Boolean allowRefOmittedArguments, Boolean inferWithDynamic, HashSet`1& useSiteDiagnostics, Boolean completeResults)
at Microsoft.CodeAnalysis.CSharp.OverloadResolution.AddMemberToCandidateSet[TMember](TMember member, ArrayBuilder`1 results, ArrayBuilder`1 members, ArrayBuilder`1 typeArguments, AnalyzedArguments arguments, Boolean completeResults, Boolean isMethodGroupConversion, Boolean allowRefOmittedArguments, Dictionary`2 containingTypeMapOpt, Boolean inferWithDynamic, HashSet`1& useSiteDiagnostics, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.OverloadResolution.PerformMemberOverloadResolution[TMember](ArrayBuilder`1 results, ArrayBuilder`1 members, ArrayBuilder`1 typeArguments, AnalyzedArguments arguments, Boolean completeResults, Boolean isMethodGroupConversion, Boolean allowRefOmittedArguments, HashSet`1& useSiteDiagnostics, Boolean inferWithDynamic, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.OverloadResolution.MethodOrPropertyOverloadResolution[TMember](ArrayBuilder`1 members, ArrayBuilder`1 typeArguments, AnalyzedArguments arguments, OverloadResolutionResult`1 result, Boolean isMethodGroupConversion, Boolean allowRefOmittedArguments, HashSet`1& useSiteDiagnostics, Boolean inferWithDynamic, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.Binder.ResolveDefaultMethodGroup(BoundMethodGroup node, AnalyzedArguments analyzedArguments, Boolean isMethodGroupConversion, HashSet`1& useSiteDiagnostics, Boolean inferWithDynamic, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.Binder.ResolveMethodGroupInternal(BoundMethodGroup methodGroup, SyntaxNode expression, String methodName, AnalyzedArguments analyzedArguments, Boolean isMethodGroupConversion, HashSet`1& useSiteDiagnostics, Boolean inferWithDynamic, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.Binder.ResolveMethodGroup(BoundMethodGroup node, SyntaxNode expression, String methodName, AnalyzedArguments analyzedArguments, Boolean isMethodGroupConversion, HashSet`1& useSiteDiagnostics, Boolean inferWithDynamic, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.Binder.BindMethodGroupInvocation(SyntaxNode syntax, SyntaxNode expression, String methodName, BoundMethodGroup methodGroup, AnalyzedArguments analyzedArguments, DiagnosticBag diagnostics, CSharpSyntaxNode queryClause, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.Binder.BindInvocationExpression(SyntaxNode node, SyntaxNode expression, String methodName, BoundExpression boundExpression, AnalyzedArguments analyzedArguments, DiagnosticBag diagnostics, CSharpSyntaxNode queryClause, Boolean allowUnexpandedForm)
at Microsoft.CodeAnalysis.CSharp.Binder.BindInvocationExpression(InvocationExpressionSyntax node, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindPossibleArrayInitializer(ExpressionSyntax node, TypeSymbol destinationType, BindValueKind valueKind, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindVariableOrAutoPropInitializer(EqualsValueClauseSyntax initializerOpt, RefKind refKind, TypeSymbol varType, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindFieldInitializer(Binder binder, FieldSymbol fieldSymbol, EqualsValueClauseSyntax equalsValueClauseNode, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindRegularCSharpFieldInitializers(CSharpCompilation compilation, ImmutableArray`1 initializers, ArrayBuilder`1 boundInitializers, DiagnosticBag diagnostics, ImportChain& firstDebugImports)
at Microsoft.CodeAnalysis.CSharp.Binder.BindFieldInitializers(CSharpCompilation compilation, SynthesizedInteractiveInitializerMethod scriptInitializerOpt, ImmutableArray`1 initializers, DiagnosticBag diagnostics, ImportChain& firstImportChain)
at Microsoft.CodeAnalysis.CSharp.Binder.BindFieldInitializers(CSharpCompilation compilation, SynthesizedInteractiveInitializerMethod scriptInitializerOpt, ImmutableArray`1 fieldInitializers, DiagnosticBag diagnostics, ProcessedFieldInitializers& processedInitializers)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass20_0.<CompileNamedTypeAsTask>b__0()
Can confirm installing 4.6.1 fixes the issue, so the requirement should be 4.6.1, not 4.6.
That's disturbing because we explicitly target 4.6 frameworks in our projects (sometimes via NetStandard). There is no intent to take a dependency on 4.6.1 in this layer because it's unnecessary.
Yup, and I've confirmed that we're netstandard1.3 and the projects target 4.6, not 4.6.1
@weshaggard @ericstj Any idea what could be going on here?
@agocke definitely Net Standad 1.3 compliant. Or at least when I port our code to the new SDK and use NetStandard 1.3 as the target it still compiles fine.
Adding @terrajobst as well.
I disassembled IsDegenerateQuery and I see the following:
IL_0001: ldfld class [System.Collections]System.Collections.Generic.Stack`1<class Microsoft.CodeAnalysis.CSharp.Syntax.QueryClauseSyntax> Microsoft.CodeAnalysis.CSharp.Binder/QueryTranslationState::clauses
IL_0006: call bool [Microsoft.CodeAnalysis]Roslyn.Utilities.EnumerableExtensions::IsEmpty<class Microsoft.CodeAnalysis.CSharp.Syntax.QueryClauseSyntax>(class [System.Runtime]System.Collections.Generic.IReadOnlyCollection`1<!!0>)
We added IReadOnlyCollection
Anyone have a repro on something other than this one machine? You should check the version of System.dll loaded if this is happening. That should indicate what's going on.
The place to look would be C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll check file properties. A build from 4.6 or later would have a file version of 4.6.x.0. I believe RTM was 4.6.81.0.
The build server hdmp references System.ni.dll, 4.0.30319.36350 built by FX452RTMLDR -- seems like a server issue then.
Indeed, that's a native image from 4.5.2. If you have a machine in repro state it's something worth investigating from the setup and/or loader side. You shouldn't be able to get in a state with 4.6 installed running on 4.5.2 bits (unless there was a pending reboot or power failure during update or something).
Looks like everything is like it should be, except for the torn server state and the fact that your package description is wrong (.NET Standard 1.3 is only supported on .NET Framework 4.6.1)
Glad to know it wasn't something wrong with our build. Was quite worried for a minute 馃槃
There is something wrong with your build: it produces a NuGet package with the wrong description ;-)
@terrajobst We have that icky bit fixed; we're building the updated packages tomorrow. :smile:
Is this bug related in any way to https://github.com/dotnet/roslyn/issues/4889 ?
Looks like this was fixed by https://github.com/dotnet/roslyn/pull/17942
Most helpful comment
There is something wrong with your build: it produces a NuGet package with the wrong description ;-)