Error MSB3041: Unable to create a manifest resource name ...

This forum is meant for questions and discussions about the X# language and tools
Post Reply
RolWil
Posts: 67
Joined: Mon Jul 18, 2022 3:16 am

Error MSB3041: Unable to create a manifest resource name ...

Post by RolWil »

Hi all,

Interesting issue. If I start the first line of my Form1.prg code with the comment statement “/*”
I get the following error at compile time:

“Error MSB3041: Unable to create a manifest resource name for "Form1.resx", Length cannot be less than zero.”
Parameter name: length OSSPremiumDeductions C:\Program Files (x86)\XSharp\MsBuild\XSharp.CurrentVersion.targets 110



If I leave line 1 blank however, the code compiles without error.

Example:
/* <--- line 1
some kind of comment
*/
USING System
USING ...


Cheers,
Roland
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Error MSB3041: Unable to create a manifest resource name ...

Post by robert »

Roland
can you send me that part of your code?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
RolWil
Posts: 67
Joined: Mon Jul 18, 2022 3:16 am

Re: Error MSB3041: Unable to create a manifest resource name ...

Post by RolWil »

Hi Robert,

here's a little more of the non-working code. If the "/*" is on line #1, the code does not work. However, if line #1 is a blank line, the code compiles and runs no problem.

Code: Select all

/*
Change History:

  Feb 09, 2010 V 2.0: Numerous changes for Pay Mod

          
*/


USING System
USING System.Collections.Generic
USING System.ComponentModel
USING System.Data
USING System.Drawing
USING System.Linq

USING System.Text
USING System.Threading.Tasks
USING System.IO...
...
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Error MSB3041: Unable to create a manifest resource name ...

Post by Chris »

Robert,

See here for a full sample

https://github.com/X-Sharp/XSharpPublic/issues/1334
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
RolWil
Posts: 67
Joined: Mon Jul 18, 2022 3:16 am

Re: Error MSB3041: Unable to create a manifest resource name ...

Post by RolWil »

Robert,
I just tried to duplicate this error with a new project and it does not occur - so what I sent you doesn't help you much.

I'll start stripping out code from the original problem code until the error no longer occurs - to determine what causes it or, I can send you the entre project if I am unable to figure it out.

Thanks
Roland
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Error MSB3041: Unable to create a manifest resource name ...

Post by robert »

Roland,
Chris has uploaded an example to Github that does reproduce the error.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Error MSB3041: Unable to create a manifest resource name ...

Post by robert »

Roland, Chris,

Some background info about the error:
There is a task in the MsBuild project that compiles ResX files. This task analyzes the PRG file that accompanies the RESX file and tries to find the namespace for the form. In the Example on Github the fully qualified name of the form is "WindowsFormsApplication56.Form1". The resource is stored as "WindowsFormsApplication56.Form1.resources" in the Exe file.
The code inside our MsBuild support file uses Regular Expressions to find the Namespace and Class name.
There is also a part of the code that remove MultiLine comments. And this part fails when the opening "/*" characters start at the 1st position in the file.
This is because it tries to extract the sourcecode before the Multi Line comment.
See here:

https://github.com/X-Sharp/XSharpPublic ... me.cs#L236
It should not do that when index has the value 0.

So a blank line, or even a space before the "/*" will solve the problem.
I'll make sure that this gets fixed in the next build.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
RolWil
Posts: 67
Joined: Mon Jul 18, 2022 3:16 am

Re: Error MSB3041: Unable to create a manifest resource name ...

Post by RolWil »

Thanks for the info Robert.
Post Reply