Comments (9)
This generally happens when the Rolsyn packages of the source generator are not using an high enough version. Could you share your generator csproj ?
from uno.sourcegeneration.
The csproj doesn't contain the versions (using paket), here the content of the paket.lock file:
remote: https://api.nuget.org/v3/index.json
Castle.Core (4.3.1)
Humanizer.Core (2.5.1)
NETStandard.Library (>= 1.6.1)
JetBrains.Annotations (2018.2.1)
Microsoft.Build (15.8.166)
Microsoft.Build.Framework (>= 15.8.166)
Microsoft.VisualStudio.Setup.Configuration.Interop (>= 1.16.30)
System.Collections.Immutable (>= 1.5)
System.IO.Compression (>= 4.3)
System.Runtime.InteropServices.RuntimeInformation (>= 4.3)
System.Threading.Tasks.Dataflow (>= 4.5.24)
Microsoft.Build.Engine (15.8.166)
Microsoft.Build.Framework (>= 15.8.166)
Microsoft.Build.Framework (15.8.166)
Microsoft.Build.Tasks.Core (15.8.166)
Microsoft.Build.Framework (>= 15.8.166)
Microsoft.Build.Utilities.Core (>= 15.8.166)
Microsoft.VisualStudio.Setup.Configuration.Interop (>= 1.16.30)
System.Collections.Immutable (>= 1.5)
System.Threading.Tasks.Dataflow (>= 4.5.24)
Microsoft.Build.Utilities.Core (15.8.166)
Microsoft.Build.Framework (>= 15.8.166)
Microsoft.VisualStudio.Setup.Configuration.Interop (>= 1.16.30)
System.Collections.Immutable (>= 1.5)
System.Runtime.InteropServices.RuntimeInformation (>= 4.3)
Microsoft.CodeAnalysis (2.9)
Microsoft.CodeAnalysis.CSharp.Workspaces (2.9)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2.9)
Microsoft.CodeAnalysis.Analyzers (2.6.2)
Microsoft.CodeAnalysis.Common (2.9)
Microsoft.CodeAnalysis.Analyzers (>= 2.6.1)
System.AppContext (>= 4.3)
System.Collections (>= 4.3)
System.Collections.Concurrent (>= 4.3)
System.Collections.Immutable (>= 1.5)
System.Console (>= 4.3)
System.Diagnostics.Debug (>= 4.3)
System.Diagnostics.FileVersionInfo (>= 4.3)
System.Diagnostics.StackTrace (>= 4.3)
System.Diagnostics.Tools (>= 4.3)
System.Dynamic.Runtime (>= 4.3)
System.Globalization (>= 4.3)
System.IO.Compression (>= 4.3)
System.IO.FileSystem (>= 4.3)
System.IO.FileSystem.Primitives (>= 4.3)
System.Linq (>= 4.3)
System.Linq.Expressions (>= 4.3)
System.Reflection (>= 4.3)
System.Reflection.Metadata (>= 1.6)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Runtime.InteropServices (>= 4.3)
System.Runtime.Numerics (>= 4.3)
System.Security.Cryptography.Algorithms (>= 4.3)
System.Security.Cryptography.Encoding (>= 4.3)
System.Security.Cryptography.X509Certificates (>= 4.3)
System.Text.Encoding (>= 4.3)
System.Text.Encoding.CodePages (>= 4.3)
System.Text.Encoding.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.Threading.Tasks (>= 4.3)
System.Threading.Tasks.Extensions (>= 4.3)
System.Threading.Tasks.Parallel (>= 4.3)
System.Threading.Thread (>= 4.3)
System.ValueTuple (>= 4.3)
System.Xml.ReaderWriter (>= 4.3)
System.Xml.XDocument (>= 4.3)
System.Xml.XmlDocument (>= 4.3)
System.Xml.XPath.XDocument (>= 4.3)
Microsoft.CodeAnalysis.CSharp (2.9)
Microsoft.CodeAnalysis.Common (2.9)
Microsoft.CodeAnalysis.CSharp.Workspaces (2.9)
Microsoft.CodeAnalysis.CSharp (2.9)
Microsoft.CodeAnalysis.Workspaces.Common (2.9)
Microsoft.CodeAnalysis.VisualBasic (2.9)
Microsoft.CodeAnalysis.Common (>= 2.9)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2.9)
Microsoft.CodeAnalysis.VisualBasic (2.9)
Microsoft.CodeAnalysis.Workspaces.Common (2.9)
Microsoft.CodeAnalysis.Workspaces.Common (2.9)
Microsoft.CodeAnalysis.Common (2.9)
SQLitePCLRaw.bundle_green (>= 1.1.2)
System.Composition (>= 1.0.31)
Microsoft.NETCore.Platforms (2.1.1)
Microsoft.Reactive.Testing (4.1.2)
System.Reactive (>= 4.1.2)
System.Threading.Tasks.Extensions (>= 4.5.1)
Microsoft.VisualStudio.Setup.Configuration.Interop (1.16.30)
Moq (4.10)
Castle.Core (>= 4.3.1)
System.Threading.Tasks.Extensions (>= 4.3)
System.ValueTuple (>= 4.4)
NETStandard.Library (2.0.3)
Microsoft.NETCore.Platforms (>= 1.1)
NuGet.CommandLine (4.7.1)
NUnit (3.11)
PostSharp (6.0.28)
PostSharp.Redist (>= 6.0.28 < 7.0)
PostSharp.Redist (6.0.28)
SQLitePCLRaw.bundle_green (1.1.11)
SQLitePCLRaw.core (>= 1.1.11)
SQLitePCLRaw.lib.e_sqlite3.linux (>= 1.1.11)
SQLitePCLRaw.lib.e_sqlite3.osx (>= 1.1.11)
SQLitePCLRaw.lib.e_sqlite3.v110_xp (>= 1.1.11)
SQLitePCLRaw.provider.e_sqlite3.net45 (>= 1.1.11)
SQLitePCLRaw.core (1.1.11)
SQLitePCLRaw.lib.e_sqlite3.linux (1.1.11)
SQLitePCLRaw.lib.e_sqlite3.osx (1.1.11)
SQLitePCLRaw.lib.e_sqlite3.v110_xp (1.1.11)
SQLitePCLRaw.provider.e_sqlite3.net45 (1.1.11)
SQLitePCLRaw.core (>= 1.1.11)
System.AppContext (4.3)
System.Collections (4.3)
System.Collections.Concurrent (4.3)
System.Collections.Immutable (1.5)
System.Composition (1.2)
System.Composition.AttributedModel (>= 1.2)
System.Composition.Convention (>= 1.2)
System.Composition.Hosting (>= 1.2)
System.Composition.Runtime (>= 1.2)
System.Composition.TypedParts (>= 1.2)
System.Composition.AttributedModel (1.2)
System.Composition.Convention (1.2)
System.Composition.AttributedModel (>= 1.2)
System.Composition.Hosting (1.2)
System.Composition.Runtime (>= 1.2)
System.Composition.Runtime (1.2)
System.Composition.TypedParts (1.2)
System.Composition.AttributedModel (>= 1.2)
System.Composition.Hosting (>= 1.2)
System.Composition.Runtime (>= 1.2)
System.Console (4.3.1)
System.Diagnostics.Debug (4.3)
System.Diagnostics.FileVersionInfo (4.3)
System.Diagnostics.StackTrace (4.3)
System.Diagnostics.Tools (4.3)
System.Dynamic.Runtime (4.3)
System.Globalization (4.3)
System.IO.Compression (4.3)
System.IO.FileSystem (4.3)
System.IO.FileSystem.Primitives (>= 4.3)
System.IO.FileSystem.Primitives (4.3)
System.Linq (4.3)
System.Linq.Expressions (4.3)
System.Reactive (4.1.2)
System.Threading.Tasks.Extensions (>= 4.5.1)
System.ValueTuple (>= 4.4)
System.Reflection (4.3)
System.Reflection.Metadata (1.6)
System.Collections.Immutable (>= 1.5)
System.Resources.ResourceManager (4.3)
System.Runtime (4.3)
System.Runtime.CompilerServices.Unsafe (4.5.2)
System.Runtime.Extensions (4.3)
System.Runtime.InteropServices (4.3)
System.Runtime (>= 4.3)
System.Runtime.InteropServices.RuntimeInformation (4.3)
System.Runtime.Numerics (4.3)
System.Security.Cryptography.Algorithms (4.3.1)
System.Security.Cryptography.Primitives (>= 4.3)
System.Security.Cryptography.Encoding (4.3)
System.Security.Cryptography.Primitives (4.3)
System.Security.Cryptography.X509Certificates (4.3.2)
System.Security.Cryptography.Algorithms (>= 4.3)
System.Security.Cryptography.Encoding (>= 4.3)
System.Text.Encoding (4.3)
System.Text.Encoding.CodePages (4.5)
System.Runtime.CompilerServices.Unsafe (>= 4.5)
System.Text.Encoding.Extensions (4.3)
System.Threading (4.3)
System.Threading.Tasks (4.3)
System.Threading.Tasks.Dataflow (4.9)
System.Threading.Tasks.Extensions (4.5.1)
System.Runtime.CompilerServices.Unsafe (>= 4.5)
System.Threading.Tasks.Parallel (4.3)
System.Threading.Thread (4.3)
System.ValueTuple (4.5)
System.Xml.ReaderWriter (4.3.1)
System.Xml.XDocument (4.3)
System.Xml.XmlDocument (4.3)
System.Xml.XPath (4.3)
System.Xml.XPath.XDocument (4.3)
System.Xml.XPath (>= 4.3)
Uno.SourceGeneration (1.26)
Microsoft.Build (>= 14.3)
Microsoft.Build.Engine (>= 14.3)
Microsoft.Build.Tasks.Core (>= 14.3)
Microsoft.CodeAnalysis (>= 1.3.2)
Microsoft.CodeAnalysis.Common (>= 1.3.2)
Microsoft.CodeAnalysis.CSharp (>= 1.3.2)
Microsoft.CodeAnalysis.CSharp.Workspaces (>= 1.3.2)
Microsoft.CodeAnalysis.Workspaces.Common (>= 1.3.2)
Uno.SourceGenerationTasks (1.26)
from uno.sourcegeneration.
Looks like it's correct. Would you be able to share a repro solution ?
from uno.sourcegeneration.
I've been able to reproduce a similar problem, and the best way to work around it is to do the following:
<PackageReference Include="Microsoft.CodeAnalysis.Common">
<Version>2.3.1</Version>
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>2.3.1</Version>
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
<Version>2.3.1</Version>
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common">
<Version>2.3.1</Version>
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
This <ExcludeAssets>runtime</ExcludeAssets>
prevents the runtime from loading an incorrect version of the Roslyn binaries, as those are not copied to the output folder of the generator.
from uno.sourcegeneration.
I'm having a similar issue in my generators. Specifically with regards to nullable reference annotations. I am referencing version 3.6.0 of Microsoft.CodeAnalysis
with ExcludeAssets
specified as above, but It doesn't appear that my source generators are actually getting 3.6.0. One example of what I'm running into is if I try to analyze a property like this:
public string? Name { get; }
I was told by an MS employee on the Roslyn team that by default, if I do a ToString()
on the property type (IPropertySymbol.Type
), it should include the nullable annotation. However, instead of getting string?
, I'm getting string
. So I try to look at the nullable annotation and add it manually, but IPropertySymbol.Type.NullableAnnotation
gives me this exception:
error CS1061: 'ITypeSymbol' does not contain a definition for 'NullableAnnotation' and no accessible extension method 'NullableAnnotation' accepting a first argument of type 'ITypeSymbol' could be found (are you missing a using directive or an assembly reference?)
It looks like my generators aren't run with 3.6.0 despite referencing that version in my project. Am I doing something wrong?
from uno.sourcegeneration.
In current builds of SourceGenerationTasks, the Roslyn version used to run the generators is:
I've made #124 to update the version to 3.6.
from uno.sourcegeneration.
Thanks! I wasn't sure if the version I used in my project had to match the version in SourceGenerationTasks, or if a newer version would be used at runtime if I specified one. Seems like it needs to match, so I'm looking forward to the new build.
from uno.sourcegeneration.
Looks like #124 still hasn't been merged, any chance of pushing that through?
from uno.sourcegeneration.
At the time there were some issues with .NET 5 preview that were not resolved. There still are, but we can work around it for now.
The build package will be available here for testing: https://pkgs.dev.azure.com/uno-platform/1dd81cbd-cb35-41de-a570-b0df3571a196/_packaging/unoplatformdev/nuget/v3/index.json
from uno.sourcegeneration.
Related Issues (20)
- Add a way for code generators to replace a file. HOT 1
- Generation may fail for Xamarin.Android projects on Azure Devops hosted agents
- Random Uno.SourceGenerationTasks.targets: error : Error reading response
- Can't use System.Text.Json or resolve types from Microsoft.Bcl.AsyncInterfaces
- Codegen in a solution HOT 4
- Support .NET Core 3.1.201 (and .NET 5) HOT 4
- [NET5] dotnet build failure under macOS and Linux
- Are netstandard2.1 or netcoreapp3.1 supported for source generator projects? HOT 6
- Add the netstandard2.0 target
- [FEAT] Add ViewBase generation HOT 2
- `Uno.SourceGenerationTasks` package is too large in size
- `Uno.SourceGeneration.dll` version doesn't match NuGet package version
- Document which version of the package to use for each Visual Studio version
- Uno.SourceGeneration.Host.exe stay open after Visual Studio closed HOT 3
- Build error when creating source generator for iOS/macOS HOT 6
- Project gets built using Visual Studio, but dotnet build results into an error HOT 27
- Add support for uap10.0.xxx in source generation tasks
- Reason behind choosing net 462 HOT 3
- Add support for persistent Generation Host
- Add support for msbuild 16.0 / VS Mac 8.0 Preview HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uno.sourcegeneration.