Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ladipro opened this issue Sep 1, 2023 · 0 comments · Fixed by #9208
Closed

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

ladipro opened this issue Sep 1, 2023 · 0 comments · Fixed by #9208
Assignees
Labels
bug Good First Issue Self-contained issues good for first-time contributors. Task: GenerateResource Problems with the task itself, resgen.exe, and resx resources in general. triaged

Comments

@ladipro
Copy link
Member

ladipro commented Sep 1, 2023

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

@ladipro ladipro added bug Task: GenerateResource Problems with the task itself, resgen.exe, and resx resources in general. Good First Issue Self-contained issues good for first-time contributors. needs-triage Have yet to determine what bucket this goes in. labels Sep 1, 2023
@JaynieBai JaynieBai self-assigned this Sep 6, 2023
@JaynieBai JaynieBai removed the needs-triage Have yet to determine what bucket this goes in. label Sep 7, 2023
rainersigwald pushed a commit that referenced this issue Sep 27, 2023
Fixes #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]
```
bulatgrzegorz pushed a commit to bulatgrzegorz/selective-condition-evaluator that referenced this issue 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]
```
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Good First Issue Self-contained issues good for first-time contributors. Task: GenerateResource Problems with the task itself, resgen.exe, and resx resources in general. triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants