"has Stopped working" message after IL Assembly editing - reverse-engineering

I am using "dnSpy" application to read and change .net assembly exe module, I chose "Edit IL Instructions..." like that
Then I change "brtrue" to "brfalse" as this picture
Then I saved a module like that
Then I run NGRN like that
Now When I test the exe application I face "Stopped Working" message as soon as I open it
Please Help

Related

Advice needed: NewtonSoft.Json and Dynamics NAV 2009 R2 Classic

I'm trying to get the Codeunit 50000 in this zip file to work: https://kappiwebhosting.blob.core.windows.net/dynamcisis/2015/09/Json.zip
Found here: https://dynamics.is/?p=2303
C/AL Globals
I'm trying to get Dynamics Nav 2009 to recognize the NewtonSoft.Json.dll, but no matter which version i try, i get this error as soon i want to verify the DotNet variable "JsonTextReader"/"JsonTextWriter" when selecting the subtype.
.NET interop: exception occured, 'Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'.
If i declare a new Test variable of type DonNet and click [...] to select it from scratch i got this error when trying to choose which assembly to use:
.NET interop: exception occured, 'Could not load file or assembly 'C:\Program Files (x86)\Microsoft Dynamics NAV\60\Classic\Add-ins\Newtonsoft.Json.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'.
The Newtonsoft.Json.dll file is present ind the folder, and "Everyone" have full control to the folder as well as the file.
The Json.zip file contain a single Newtonsoft.Json.dll which i started out with. Same error. The i downloaded the https://github.com/JamesNK/Newtonsoft.Json/releases and tried all versions with the same result.
Why all this? Yes, the company i work for have decided to start using Shopify, and i need to write an interface for getting orders from Shopify etc.
I really cannot figure out why i can't get this to work. There are 3 other DotNet "variables" that's configured and works as intended with no errors.
So any advice is highly appreciated.
Thanx

Microsoft Band SDK Deploy Error: To ARM in Release: Raw error code: 2148733978

I'm getting the following error when trying to deploy an app with the Microsoft Band SDK. The build config is RELEASE and the target output is ARM. If use DEBUG config, it works.
Error : DEP6810 : MdilXapCompile.exe failed with error code 2001.
I've examined the MDILXapCompileLog and the following is the where the compilation failed:
CrossGen failed
Error processing assembly [projectpath]...\obj\ARM\Release\MSIL\Microsoft.Band.dll
Raw error code: 2148733978
NOTE: The extra weird part about this situation is that if I only package the app without deploying, I can side-load it to the device and it works as expected.
Here are the csproj sections - Debug/ARM:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
Release/ARM
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
The only difference I see are the debug symbols, could the Microsoft.Band.dll not have public symbols? Isn't Visual Studio supposed to created them?
I noticed that the solution still had the old Band SDK - Preview packages even after updating to the newer SDK. I manually deleted all the nuget items, forced a package refresh and the project now deploys successfully.
Here are the steps:
Close Visual Studio
Navigate to YourSolution/Packages/
Delete everything except packages.config
Reopen the solution in Visual Studio
Right click on solution and select "Manage Nuget Packages"
Click the "Restore" button that appears at the top of the dialog window
Rebuild the solution and it should deploy properly

Brokered Component not working when deploying to client

I created a test App with brokered copmonent and it runs smooth on my machine, but when moved it to a tablet and did all the required settings (regsvr32, icacls), it throws an exception. then I went and downloaded the Microsoft Northwind sample and it act the same. works fine on my machine but not on the other tablet. Am I missing any thing here? here is the exception, it's casting exception and Access denied exception:
Unable to cast COM object of type 'NorthwindRT.DAL.FileWatcher' to interface type 'NorthwindRT.DAL.IFileWatcherClass'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{23F40340-AEB1-5774-5705-64488C9BDD3A}' failed due to the following error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
but I did on the tablet the same things I did on the developing machine!
I moved the required files to the correct directory and enabled read/execute to all applications and I registered the proxy using regsvr32. Also the user can access the directory where the implementation dll is located so Access is denied exception is weird.
I did my research about brokered comp and I am doing exactly like the available documentations!
Any Ideas? Am I missing anything here? Is there extra settings I need to do? is my system missing any required dlls?
The App does not have access to msvcr120d.dll
add "ALL APPLICATION PACKAGES" to this dll and it will solve the issue.
I am also working on brokered component, so far I did had some success in development as well as deployment.
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
You need to run icacls in the folder where you have the proxystub.dll and the winmd implementation.
icacls . /T /grant "ALL APPLICATION PACKAGES":RX
Now if you're deploying to a device that does not have a dev environment (i.e. Visual studio), you need to install Visual C++ Redistributable for Visual Studio 2015 (you can use whatever VS version you have, it just happend that i am using VS2015). You can download it here. And one more thing, since you don't have a development environment in the device, you would like to deploy Release assemblies not Debug so that the assemblies won't be referencing libraries or dll that is for debug (i.e. msvcr120.dll instead of msvcr120d.dll) because it won't be found in a clean device.
Lastly, I have a blog about brokered component. You might want to check it out.

Monodevelop 2.8.6 on windows

I hope someone can answer this as its driving me crazy. I have installed Monodevelop on windows XP. The version being 2.8.6.5. I set the default/active runtime as Microsoft .Net and set my projects to target .net 4.0 via project settings BUILD-->General->Target framework.
When I debug it from the application output window it loads XSP 2.0 and tries to the old .Net 2 DLL's ie from the .Net 2 GAC - C:\windows\assembly instead of the .Net 4 GAC.
when I debug setting Mono as the active runtime it works ok.
I get the error, which is understandable given the fact the build is targeting .Net 4 yet its looking at the wrong runtime:
Could not load file or assembly 'TestWeb' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'TestWeb' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Here is the output from the Output window:
Loaded Module 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'
Started Thread 1872
Loaded Module 'C:\Program Files\MonoDevelop\bin\xsp2.exe'
Loaded Module 'C:\WINDOWS\assembly\GAC_MSIL\MonoDevelop.Xsp\2.8.0.0__0738eb9f132ed756\MonoDevelop.Xsp.dll'
Loaded Module 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'
Loaded Module 'C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
Loaded Module 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
Loaded Module 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'
many thanks
Simon.

Problem hosting wcfservice on mydoamin.com

I have an asp.net and a wcf service created. I hosted wcfservice on localhost(IIS) and the as.net web application also on IIS. Both work fine. I want to host both wcf and my asp.net web application on a registered domain. But when I right click on wcf service & click on publish and eneter details of the site I got error
""The "IsCleanMSDeployPackageNeeded" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or
assembly
'Microsoft.Web.Deployment, Version=7.1.0.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system
cannot find the file specified."
Affte googleing I installed MSwebdeplot v2 on my machine &
tried again. but this tiel I get error "Web deployment
task failed. (Attempt by method
'Microsoft.Web.Publishing.Tasks.VSMSDeployDriverInCmd.LogTrace
(Microsoft.Web.Deployment.DeploymentTraceEventArgs)' to access type
'Microsoft.Web.Deployment.DeploymentSyncParameterEventArgs' failed.) "
I tried to get solution from internet but no luck. pls help me. I have attached the screen shot also.
You need this: http://www.iis.net/download/WebDeploy