xsharp.eu • Error MSB3041: Unable to create a manifest resource name ...
Page 1 of 1

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

Posted: Sat Sep 09, 2023 11:32 am
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

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

Posted: Sat Sep 09, 2023 5:05 pm
by robert
Roland
can you send me that part of your code?

Robert

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

Posted: Sun Sep 10, 2023 12:56 am
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...
...

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

Posted: Sun Sep 10, 2023 6:22 am
by Chris
Robert,

See here for a full sample

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

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

Posted: Mon Sep 11, 2023 11:06 am
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

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

Posted: Mon Sep 11, 2023 2:22 pm
by robert
Roland,
Chris has uploaded an example to Github that does reproduce the error.

Robert

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

Posted: Mon Sep 11, 2023 2:32 pm
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

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

Posted: Mon Sep 11, 2023 3:55 pm
by RolWil
Thanks for the info Robert.