Skip to content

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

@ladipro

Description

@ladipro

Issue Description

The task is missing proper error handling.

Steps to Reproduce

<Project>
  <Target Name="Build">
    <GenerateResource Sources="non-existent" OutputResources="out" />
  </Target>
</Project>

Expected Behavior

A build error.

Actual Behavior

"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]

Analysis

No response

Versions & Configurations

MSBuild version 17.8.0-preview-23353-01+946c58411 for .NET Framework

Metadata

Metadata

Assignees

Labels

Area: Task: GenerateResourceProblems with the task itself, resgen.exe, and resx resources in general.Good First IssueSelf-contained issues good for first-time contributors.bugtriaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions