Repository navigation
Closed
Labels
difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.kind/bugSomething isn't workingtriage/untriagedIndicates an issue requires triaging or verification
Description
Current behavior
Testing Uno.Samples on VS2022 preview 3 gives error when building projects with LangVersion 8.0 included in the .csproj file.
1>MSBUILD : error : Generation failed: System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.
1>MSBUILD : error :
1>MSBUILD : error : Server stack trace:
1>MSBUILD : error : at Microsoft.Build.Shared.FileMatcher.IsFileNameMatch(String path, String pattern)
1>MSBUILD : error : at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
1>MSBUILD : error : at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
1>MSBUILD : error : at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
1>MSBUILD : error : at Microsoft.Build.Shared.FileMatcher.GetFilesForStep(RecursiveStepResult stepResult, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory)
1>MSBUILD : error : at Microsoft.Build.Shared.FileMatcher.GetFilesRecursive(ConcurrentStack`1 listOfFiles, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory, IList`1 searchesToExclude, Dictionary`2 searchesToExcludeInSubdirs, TaskOptions taskOptions)
1>MSBUILD : error : at Microsoft.Build.Shared.FileMatcher.GetFilesImplementation(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
1>MSBUILD : error : at Microsoft.Build.Shared.FileMatcher.<>c__DisplayClass67_0.<GetFiles>b__1(String _)
1>MSBUILD : error : at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
1>MSBUILD : error : at Microsoft.Build.Shared.FileMatcher.GetFiles(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
1>MSBUILD : error : at Microsoft.Build.Internal.EngineFileUtilities.GetFileList(String directoryEscaped, String filespecEscaped, Boolean returnEscaped, Boolean forceEvaluateWildCards, IEnumerable`1 excludeSpecsEscaped, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
1>MSBUILD : error : at Microsoft.Build.Internal.EngineFileUtilities.GetFileListEscaped(String directoryEscaped, String filespecEscaped, IEnumerable`1 excludeSpecsEscaped, Boolean forceEvaluate, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpression(String directoryOfImportingFile, ProjectImportElement importElement, String unescapedExpression, Boolean throwOnFileNotExistsError, List`1& imports)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
1>MSBUILD : error : at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext)
1>MSBUILD : error : at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
1>MSBUILD : error : at Uno.SourceGeneration.Host.ProjectLoader.LoadProjectDetails(BuildEnvironment environment, Dictionary`2 globalProperties) in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\ProjectLoader.cs:line 143
1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.Generate() in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 85
1>MSBUILD : error : at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
1>MSBUILD : error : at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
1>MSBUILD : error :
1>MSBUILD : error : Exception rethrown at [0]:
1>MSBUILD : error : at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
1>MSBUILD : error : at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
1>MSBUILD : error : at Uno.SourceGeneratorTasks.RemoteSourceGeneratorEngine.Generate(RemotableLogger2 logger, BuildEnvironment environment)
1>MSBUILD : error : at Uno.SourceGeneration.Host.Server.GenerationServerHost.GenerateForCollection(EnvironmentPool collection, BuildEnvironment environment) in D:\a\1\s\src\Uno.SourceGeneration.Host\Server\GenerationServerHost.netframework.cs:line 61
1>MSBUILD : error : at Uno.SourceGeneration.Host.Server.GenerationServerHost.RunGeneration(RunRequest request, CancellationToken cancellationToken) in D:\a\1\s\src\Uno.SourceGeneration.Host\Server\GenerationServerHost.cs:line 73
1>C:\Users\SuperPC\.nuget\packages\uno.sourcegenerationtasks\4.0.2\build\netstandard1.0\Uno.SourceGenerationTasks.targets(134,2): error : Generation failed, error code Rejected
1>Done building project "UnoChat.Client.Wasm.csproj" -- FAILED.
Expected behavior
The samples build successfully. If the LangVersion 8 is not supported, a better message when building to make troubleshooting easier.
How to reproduce it (as minimally and precisely as possible)
Add 8.0 to a .csproj file, these are included in some of the samples, I tested ChatSignalR and SkiaSharpTest, also fails when adding to a sample which doesn't include LangVersion.
Workaround
Update .csproj to use LangVersion 9 or higher
Works on UWP/WinUI
Yes
Environment
No response
NuGet package version(s)
from ChatSignalR sample
<ItemGroup>
<!-- Note that for WebAssembly version 1.1.1 of the console logger required -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.1.6" />
<PackageReference Include="MVx.Observable" Version="2.0.0" />
<PackageReference Include="Uno.UI.Lottie" Version="4.1.9" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.0.1" />
<PackageReference Include="Uno.UI.WebAssembly" Version="4.1.9" />
<PackageReference Include="Uno.UI.RemoteControl" Version="4.1.9" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="4.1.9" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="3.2.0" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="3.2.0" />
</ItemGroup>
Affected platforms
Build tasks
IDE
Visual Studio 2022
IDE version
17.3.0 Preview 3.0
Relevant plugins
No response
Anything else we need to know?
No response
Metadata
Metadata
Assignees
Labels
difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.kind/bugSomething isn't workingtriage/untriagedIndicates an issue requires triaging or verification
Activity
francoistanguay commentedon Jul 16, 2022
What a great catch. Thank you, the team will investigate asap now that we have a repro!
francoistanguay commentedon Jul 19, 2022
So, team found the issue:
The new msbuild shipped with 17.3 Preview 3 includes this commit where they bumped the System.Memory version: dotnet/msbuild@bfd80ab
Our Source Gen Host therefore suddendly become incompatible because of that breaking change.
If you do an bindingRedirect ,in this file it should start working again : "C:\Users\User.nuget\packages\uno.sourcegenerationtasks\4.0.2\build\host\net472\Uno.SourceGeneration.Host.exe.config"

Short term, we'll push an update to our Source Generation Host.
artemious7 commentedon Jul 20, 2022
Thanks, it did the trick!
The file is in
C:\Users\<user>\.nuget\packages\uno.sourcegenerationtasks\<your_version>\build\host\net472\Uno.SourceGeneration.Host.exe.configHere's the text to easily paste it:
Save and restart Visual Studio
francoistanguay commentedon Jul 20, 2022
Thank you for the more accurate details!
francoistanguay commentedon Jul 23, 2022
The new Uno Source Generation host now tonains the updated dependency to System.Memory so the nuget should be updated to latest dev: https://www.nuget.org/packages/Uno.SourceGenerationTasks/4.1.0-dev.9
pkar70 commentedon Aug 18, 2022
So, when my app uses Uno 4.2.6, workaround presented here ("set LangVersion to 9") works. But for newer Uno versions this workaround doesn't work, and app doesn't compile.
What should I do to be able to use Uno > 4.2.6?
jeromelaban commentedon Aug 18, 2022
@pkar70 see #9531
fix: Fix Android build on VS 17.3
Quick fix to enable building locally to workaround unoplatform/uno#9297
SettingsExpander (#253)
SettingsExpander (#253)
zipswich commentedon Aug 10, 2025
Can't believe that the following was suddenly needed to fix a Uno.SourceGenerationTasks error in August 2025
I found this out after struggling for hours by trying all kinds of things related to SDKs, NuGet packages.
I am using Uno.SourceGenerationTasks 4.2.0 refereced by Uno.UI 4.10.39
github-actions commentedon May 2, 2026
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests.