Here are details of the solution that applied in my specific case.
I took a look at the output in the Report Navigator ⌘9 (right-most icon at the top of the Navigator pane, which is at the left edge of Xcode). I clicked on the most recent failed build shown in the list, and that produced a detailed list of modules and files that were compiled in the build.
I was able to narrow down the problem to a source file in third-party code which was using a symbol that is not yet available to me for my macOS target requiring macOS 11.3. The errant symbol (AttributedString) was found within a conditional compilation block similar to this:
#if compiler(>=5.5)
@available (iOS 15, macOS12, tvOS 15, watchOS 8, *)
extension AttributedString { ... }
#end if
Fortunately, the maintainers of the third-party code were quick to remedy the problem by further refining the conditional compilation as follows:
#if compiler(>=5.5) && !os(macOS) && !targetEnvironment(macCatalyst)
@available (iOS 15, macOS12, tvOS 15, watchOS 8, *)
extension AttributedString { ... }
#end if
So before the fix, I got the error that is the subject of this post:
warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature")
Also before the fix, the accompanying type error was:
Cannot find type 'AttributedString' in scope
After the fix, these errors went away since the offending symbol was not compiled.
So there's a type (such as CLLocation in the original post) that isn't available in the current framework set, but it is being encountered somewhere in source code where maybe it should be conditionally not compiled at all.
In my case, the third-party code was being used via Swift Package Manager, so I had to right-click on the package in the Project Navigator ⌘1 and choose "Update Package".
Can you find and show the minimized steps to reproduce the issue?
I also upgraded to Xcode 13 and have the same error
warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target .... Command CompileSwift failed with a nonzero exit code
I deleted the DerivedData folder and also cleaned the build folder, it makes no difference. Every time I compile the app I get the same error.
I am looking in the DerivedData/.....build/Objects-normal/arm64/ folder
For classes that compiled successfully, 7 files were created with the same name and different extensions, as follows .d .dia .o .swiftdeps ~partial.swiftdoc ~partial.swiftmodule ~partial.swiftsourceinfo
However for the classes that did not compile only the following two files were created .d .dia Also the .dia file was a file of zero bytes So it appears to have fallen over when creating the .dia file