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

Can't load ASPX Page on stable mono releases. Works only on Mono 5.0.1.1 #9883

Open
MattL0 opened this issue Aug 4, 2018 · 22 comments
Open

Comments

@MattL0
Copy link

MattL0 commented Aug 4, 2018

Hi,

The program Homeseer use mono to run itself on Linux. But people who wants to load .aspx pages from it can't do it with the stable Mono version. It only works with Mono 5.0.1.1. So to use .aspx page we have to downgrade mono to 5.0.1.1

It would be nice to get the .aspx function back in the stable release.

Thank you so much.

@MattL0
Copy link
Author

MattL0 commented Aug 4, 2018

@MattL0
Copy link
Author

MattL0 commented Aug 4, 2018

an error exemple with mono 5.8.0.108

`System.Web.Compilation.CompilationException
error VBNC30248: CHANGEME

Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.
Details: error VBNC30248: CHANGEME
Error origin: Compiler
Error source file: ~/Global.asax
Exception stack trace:
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x00312] in <52b8d38f1da445f7ad770be558c9fed4>:0
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00008] in <52b8d38f1da445f7ad770be558c9fed4>:0
at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp, System.Boolean debug) [0x00202] in <52b8d38f1da445f7ad770be558c9fed4>:0
at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath vp, System.Boolean debug) [0x00106] in <52b8d38f1da445f7ad770be558c9fed4>:0
Version Information: 5.8.0.108 (tarball Fri Jan 19 18:15:21 UTC 2018); ASP.NET Version: 4.0.30319.42000 `

@MattL0
Copy link
Author

MattL0 commented Aug 4, 2018

just tried to load a aspx web page with the latest mono release on debian :

Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.

Details: error VBNC30248: CHANGEME

Error origin: Compiler

Error source file: ~/Global.asax

Exception stack trace:

at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x00312] in :0
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00008] in :0
at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp, System.Boolean debug) [0x00202] in :0
at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath vp, System.Boolean debug) [0x00106] in :0

Version Information: 5.12.0.301 (tarball Wed Jul 25 16:06:44 UTC 2018); ASP.NET Version: 4.0.30319.42000

@MattL0
Copy link
Author

MattL0 commented Nov 4, 2018

I know Aspx is ''old''. But if someone knows how to resolve that i think we can donate a certain ammount $$ on hs3 side ! I'll start something , if someone want to resolves this bug.

Thanks

@MattL0
Copy link
Author

MattL0 commented Nov 4, 2018

If interested Write me an email; MattL0 a hotmail dot com

@peteeee
Copy link

peteeee commented Nov 4, 2018

Does ASPX work with updated Mono 5.X updated to last 5.X release?

@MattL0
Copy link
Author

MattL0 commented Nov 4, 2018

Yes updated to 5.16. It does not work.

5.18 does not work too.

@FalcoGer
Copy link

I may add that since this is apparently a dupe of my #10066 that this only happens with visual basic pages. c# pages seem to work fine. at least for me. too bad I'm forced to do vb.net webforms.

@BillSobel
Copy link

The VB compiler that ships with mono VBNC does not support the #ExternalChecksum directive.  It appears that sometime after 5.0.1.1 Mono began emitting this directive in VB files, thus breaking HS VB based web pages. I have opened an issue with mono-basic requesting that this directive be 'eaten'.  

This appears to be the change, so this only happens if mono is run with /debug OR the mono compiler is called with IncludeDebugInformation set to true (IncludeDebugInformation gets OR'd with the debug flag in a few places, so I think setting either gets us to this case).

In Mono 5.0.1.1 the following is commented out:

/* Disabled. It causes problems now. -- Gonzalo
if (options.IncludeDebugInformation)
args.AppendFormat("/debug ");
*/

in Mono 5.16 it changed to:

if (options.IncludeDebugInformation) {
sb.Append("/D:DEBUG=1 ");
sb.Append("/debug+ ");
}
else {
sb.Append("/debug- ");
}

@BillSobel
Copy link

Lastly, I recommend this be closed against Mono and remain as an issue with only Mono-Basic as Mono-Basic needs to make the change to handle this valid directive correctly (or at least ignore the directive).

@MattL0
Copy link
Author

MattL0 commented Nov 24, 2018

Closed

please continue here . Thanks Bill

mono/mono-basic#52

@marek-safar
Copy link
Member

mono-basic is no longer maintained and it has been replaced with vbc compiler. Our CodeDom implementation will need to be updated to call it.

@manukautech
Copy link

@MattL0 writes "So to use .aspx page we have to downgrade mono to 5.0.1.1". I am therefore trying to do that .. but how? I have found the page:
https://www.mono-project.com/docs/getting-started/install/linux/#accessing-older-releases
which states: 'you can modify the Debian repository to “stable-jessie/snapshots/X.XX.X” instead of “stable-jessie”.'
I admit being a linux learner and I have made good progress on other challenges but I am very blocked with 'modify the Debian repository'. Searches and reading tracks down a candidate file "mono-official-stable.list" in directory "/etc/apt/sources.list.d". This contains the statement:
deb https://download.mono-project.com/repo/ubuntu stable-focal main
Looks promising, but no mention of the mysterious entity "stable-jessie".
Am I correct that I need to edit this statement?
I have experimented with this statement with every variation I can think of e.g.
deb https://download.mono-project.com/repo/ubuntu stable-focal/snapshots/5.0.1.1 main
deb https://download.mono-project.com stable-jessie/snapshots/5.0.1.1 InRelease (closely followng the accessing older releases page)
However I always get error messages of the does not exist, cannot find variety.
Following what comes up on other web searches, I have also tried:
sudo apt install -t '5.0.1.1' mono-complete
and from this askubuntu web page:
https://askubuntu.com/questions/92019/how-to-install-specific-ubuntu-packages-with-exact-version
sudo apt install mono-complete=5.0.1.1
All attempts not working. Am I close with these approaches or should I be doing something completely different?

@MattL0
Copy link
Author

MattL0 commented Jan 4, 2021

Can I ask you something? Is this for HomeSeer usage?

@manukautech
Copy link

@MattL0 Hi Matt - No. A different app. I will tell the backstory. I am interested in the ability of the Raspberry Pi 4 to run as a mini server using less than 5 watts of power under medium load. I have a windows programming background mostly as a teacher of programming. My education and film-making communities of interest are both interested in energy efficiency in this time of climate change and a good test case is to replace an old PC mini server consuming 40 W at idle, which it does most of the time, with a Raspberry Pi 4 idling at 4 W. The main website of interest and a good immediate demonstration target is an aspx website which just happens to be programmed in vb.net.
https://www.iafilm.co.nz
This website is a good complexity test and well known in my communities. Therefore if it runs on Raspberry Pi then it can make a good energy efficiency story. Last time I trialled mono, way back about 2010. I had test websites with vb.net working well. But on revisiting mono I have run into big challenges with vb.net.

The Raspberry Pi 4 runs XUbuntu 64 bit. It does run C# ASPX test pages well. It has been a detective story to run searches based on the ASPX VB.NET error messages and the trail has led to here.

In the medium term I plan to radically update or replace this website with an ASP.NET CORE 5 version with C#. There appears to be good support for this on Linux with a technology that appears to be a child of mono. Most of my programming in recent years is ASP.NET CORE C# and my next move will be to try one of those. We do however have a significant ASPX VB.NET legacy and running these in the interim on a downgraded mono 5.0.1.1 is a useful exercise until we can do better.

Sharing info about Linux on Raspberry Pi. It cannot run my fave database Microsoft SQL Server because of a CPU architecture requirement for the Linux version. I have been doing trial migrations to Sqlite and MySQL and that has been going well on Windows. Todo find out if these migrate well to Linux. I like Sqlite but I am guessing that MySQL will be easier to program on Linux because of not needing to engage with a very different file system io.

@manukautech
Copy link

@MattL0 - I took a different approach today and went for migrating from VB.NET to C#. Took about 5 hours which was better than expected. This aspx web app has 20 x aspx pages with code-behind plus 3 class files one of which has 700 lines of code. I started with automatic conversion with SharpDevelop
https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.CodeConverter
I downloaded it as a plugin for Visual Studio. I got a message that it cannot process aspx web apps in one process so I converted each file separately. Example cleanups needed:

  • High level C# - Sharpdevelop output some code which was too newfangled in style to go with my ASP.NET version 4.5.2 setting.
  • A lot of strict typing needed, mostly adding .ToString() to objects e.g Session("HREFBack") becomes Session["HREFBack"].ToString(); Statements involving "" and Nothing needed rewriting for correct C# handling of null.
  • aspx pages needed header line edits from "VB" to "C#" and the code-behind extension changed from ".vb" to ".cs"
  • aspx pages in my app had AutoEventWireup="false" in the header line. I was puzzled by C# code-behind not running for no apparent reason but I fixed that by changing to AutoEventWireup="true". How I found out about that, and some other elements was that in Visual Studio I started a mini new C# ASPX website project and checked with that for some ideas.
  • aspx pages in my app needed more code in their active submit buttons - OnClick="btnLogin_Click"
    e.g
    <asp:button id="btnLogin" runat="server" Text="Login">
    needed to change to:
    <asp:button id="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" >

10 people worked on this app 2003 - 2009 and I appear to have migrated it successfully in 1 day. Which suggests that VB.NET to C#.NET migration is a relatively time-efficient move. The big question now is does it work with mono? It is late at night here now so I will get some sleep and find out about that tomorrow or maybe the next day. In the meantime the website is still running on windows, but it is now migrated to C# - stepping towards mono and the "Pi".
https://iafilm.co.nz

In summary, this issue affects one large website for me. My workaround is "migrate to C#".

@manukautech
Copy link

manukautech commented Jan 6, 2021

@MattL0 - Website is now appearing on screen. Migration lessons:

Migration tools depend a lot on VB Functions that can be provided to C# by file "Microsoft.VisualBasic.dll". This is working with mono for me. I needed to find it under "C:\Windows\Microsoft.NET\ ..." and copy it into the "Bin" subfolder.

I then had a "System.BadImageFormatException" error message. I was expecting trouble with "sqlite" so I eliminated "sqlite" references and code and that "upgraded" me to a new and better error:
System.IO.FileNotFoundException
Could not find a part of the path '/home/johnc/Documents/iafcs3/\Content\Public'.

Good specific error message. Not a surprise that I needed to deal with file system forward slashes in Linux versus backslashes in Windows. I recoded with forward slashes everywhere after doing some trials and confirming that Windows tolerates forward slashes in file addresses. Windows reads file addresses with backslashes so I added some Replace statements to deal with that.

Current state on first run. Most navigation is OK which is a pleasant surprise - as in it is working better than I expected. Case sensitivity is an issue. I expected that in file system code but after many years of experience with Windows Servers it came as a surprise to me that URLs are displaying case sensitivity. Example: I have a link to "default.aspx" which mis-matches "Default.aspx". Without "sqlite" I have lost all database-related functionality so it is the basics that are currently working.

An annoying difference between Windows and Linux - consider this C# code:
var targetDir = new System.IO.DirectoryInfo(sTargetDirPath);
var fiArr = targetDir.GetFiles();
On Windows I read the filenames out of the array fiArr and they are in alphabetical order. Not on Linux! I will need to add sorting code for those filenames.

My next move is to search for information on migrating sqlite to mono. If no result from that I will migrate - again - to MySQL.

@manukautech
Copy link

Sqlite pleasant surprise. I found "Mono.Data.Sqlite"on NuGet. Works well on both Windows and Linux - well done to the creators of this component. The only "trick" I needed: for development on Windows with Visual Studio it only worked when I copied the 32-bit version of "sqlite.dll" into folder "Bin" alongside "Mono.Data.Sqlite.dll". I am guessing that this is because Visual Studio is 32-bit. I then needed to remove this file on deployment to machines with Sqlite installed.

@manukautech
Copy link

manukautech commented Jan 11, 2021

My Pi + Linux migration is currently online - although as an experimental work in progress it may only be for a few days.
I intend to keep it going until at least the end of Wed midnight GMT, 13 Jan 2021.
https://www.manukautech.info/iafilm-pi/
EDIT - 17 Jan 2021 - Migration complete, the mono-on-Pi+Xubuntu version is now the website.
https://iafilm.co.nz/
The windows machine is shut down and is therefore no longer available for comparison.
Brief cookie etc notice. The only cookie is an in-memory temporary session cookie.
Comment. I found the nginx fastcgi setup with fastcgi-mono-server4 to be very challenging with a long "learning curve".

@manukautech
Copy link

And another experience from this migration.
I converted all aspx pages to C# but about half of them threw errors at runtime that the VB Compilation had failed. I searched the app to remove any and all code and references related to "VB" and "Basic" and related keywords - the error persisted. My successful workaround was to "Publish" the app with "PreCompiling" on the Windows dev machine - and deploy that on Linux.

@MattL0
Copy link
Author

MattL0 commented Jan 15, 2021

Sorry for being late.

The fix(workaround) we use at homeseer is to transfer the content of /usr/bin/vbc to /usr/bin/vbnc

with this command : sudo install -p /usr/bin/vbc /usr/bin/vbnc

So mono would use the vbc compiler instead of vbnc.
Vbnc is now legacy. (Mono should fix this..)

Not sure if this ‘’hack’’ would work for you.

@manukautech
Copy link

@MattL0 - Migration to C# has worked for my film-making website. Your method looks like a good workaround and it goes on my todo list for when I get any other vb aspx sites to migrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants