Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to fix a .NET application?

Featured Replies

Posted

Hello everyone I hope someone can help me.


I'm using Mono.Cecil.dll to edit the name of the Namespaces/Classes/Functions. Everything is alright but when I save it and then I run it it shows an error of Windows that leaves to work.


 


Here is my code:



Dim assembly As AssemblyDefinition
assembly = AssemblyFactory.GetAssembly("The path of the .NET file")
Dim definition3 As TypeDefinition
For Each definition3 In assembly.MainModule.Types
EditType(definition3)
Next
AssemblyFactory.SaveAssembly(assembly, Application.StartupPath & "\App1.exe")

And for the "EditType" function:



Private Sub EditType(ByVal type As TypeDefinition)
If ((((type.Name <> "<Module>") AndAlso Not type.IsRuntimeSpecialName) AndAlso (Not type.IsSpecialName AndAlso Not type.Name.Contains("Resources"))) AndAlso ((Not type.Name.StartsWith("<") AndAlso Not type.Name.Contains("__")))) Then
Dim fullName As String = type.FullName
type.Name = "Here random strings"
Dim definition2 As ModuleDefinition
For Each definition2 In assembly.Modules
Dim reference As TypeReference
For Each reference In definition2.TypeReferences
If (reference.FullName = fullName) Then
reference.Name = type.Name
End If
Next
Next
End If
End Sub

The code is well but I searched to fix this problem of the "App leave to work" message but I didn't find nothing :(


 


Thanks a lot! :D


Why don't you use

- AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(@"c:\full\path\to\original.exe");

- assembly.Write(@"c:\full\path\to\edited.exe"); ?

And if you get an error, why don't you debug it rather than compiling then running ?

  • Author

@mArTi This option it's for a newer version of Mono.Cecil.dll and i'm using an old version because I need some utilities from it. :)


Thanks for replying!


Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.