Skip to content

Conversation

JaynieBai
Copy link
Member

@JaynieBai JaynieBai commented Sep 7, 2023

Fixes #9199

Context

The unhandled exception is from https://github.com/dotnet/msbuild/blob/3c910ba83fc9dbd8e12f50dddc8c381404f928c4/src/Tasks/GenerateResource.cs#L1132C13-L1133. But when source is not found and has errors, it should return false in Execute function.

Changes Made

Return false if there are no valid sources found.

Testing

Add a unit test case.
image

Notes

@JaynieBai JaynieBai changed the title return false if there are sources return false if there are no sources Sep 7, 2023
@JaynieBai JaynieBai changed the title return false if there are no sources Return false if there are no sources Sep 7, 2023
@JaynieBai JaynieBai marked this pull request as ready for review September 11, 2023 06:17
Co-authored-by: Rainer Sigwald <[email protected]>
@rainersigwald rainersigwald merged commit 5778159 into main Sep 27, 2023
@rainersigwald rainersigwald deleted the jennybai/issue9199 branch September 27, 2023 13:35
bulatgrzegorz pushed a commit to bulatgrzegorz/selective-condition-evaluator that referenced this pull request Oct 16, 2023
…net#9208)

Fixes dotnet#9199 by avoiding an unhandled exception:

```
"C:\temp\testgenres\project.proj" (default target) (1) ->
  MSBUILD : error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled [C:\temp\testgenres\project.proj]
MSBUILD : error :     Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: There should be resource files to process [C:\temp\testgenres\project.proj]
MSBUILD : error :    at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Exception innerException, Object[] args) [C:\temp\testgenres\project.proj]
MSBUILD : error :    at Microsoft.Build.Tasks.GenerateResource.TransformResourceFilesUsingResGen(List`1 inputsToProcess, List`1 outputsToProcess) [C:\temp\testgenres\project.proj]
MSBUILD : error :    at Microsoft.Build.Tasks.GenerateResource.GenerateResourcesUsingResGen(List`1 inputsToProcess, List`1 outputsToProcess) [C:\temp\testgenres\project.proj]
MSBUILD : error :    at Microsoft.Build.Tasks.GenerateResource.Execute() [C:\temp\testgenres\project.proj]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GenerateResource crashes when passed a non-existent file

3 participants