Error on LoadApplication in Xamarin Forms PCL
I created a new Xamarin Forms PCL
solution, and in debug mode I checked the Enable ProGuard
option and I selected Linking
comboxbox to Sdk and User Assemblies
.
Now I run my application on android, after that it shows me an error in MainActivity.cs class and on line
LoadApplication(new App());
Error:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
I do that because of to decrease the size of my release app, and I have to change the release mode to debug in order to check what happened.
c# android xamarin portable-class-library
|
show 3 more comments
I created a new Xamarin Forms PCL
solution, and in debug mode I checked the Enable ProGuard
option and I selected Linking
comboxbox to Sdk and User Assemblies
.
Now I run my application on android, after that it shows me an error in MainActivity.cs class and on line
LoadApplication(new App());
Error:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
I do that because of to decrease the size of my release app, and I have to change the release mode to debug in order to check what happened.
c# android xamarin portable-class-library
I assume you are using Xamarin Forms? Please post the line of code that is throwing the error. I think your issue is that you need to change it toLoadApplication(new PCLNameHere.App())
– Tristan
Mar 3 '18 at 8:36
I tried that , but it falls into error on line LoadApplication(new App()); The important point is , when i changed Linking option to none and unchecked ProGuard option , my applicatrion run successfully. I need those options to decrease my final .apk file
– Amir Hossein Khajegan
Mar 3 '18 at 8:49
What does the rest of the stacktrace say?
– hvaughan3
Mar 3 '18 at 16:27
Linking against SDK assemblies only isn't enough?
– hichame.yessou
Mar 4 '18 at 1:23
@hvaughan3 The value of my Environment.StackTrace is : at System.Environment.get_StackTrace () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception ex) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Object.d09f62bf-1e4f-438b-810e-1b2febfe5330 (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
– Amir Hossein Khajegan
Mar 4 '18 at 12:46
|
show 3 more comments
I created a new Xamarin Forms PCL
solution, and in debug mode I checked the Enable ProGuard
option and I selected Linking
comboxbox to Sdk and User Assemblies
.
Now I run my application on android, after that it shows me an error in MainActivity.cs class and on line
LoadApplication(new App());
Error:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
I do that because of to decrease the size of my release app, and I have to change the release mode to debug in order to check what happened.
c# android xamarin portable-class-library
I created a new Xamarin Forms PCL
solution, and in debug mode I checked the Enable ProGuard
option and I selected Linking
comboxbox to Sdk and User Assemblies
.
Now I run my application on android, after that it shows me an error in MainActivity.cs class and on line
LoadApplication(new App());
Error:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
I do that because of to decrease the size of my release app, and I have to change the release mode to debug in order to check what happened.
c# android xamarin portable-class-library
c# android xamarin portable-class-library
edited Nov 24 '18 at 19:01
Federico Grandi
3,16621229
3,16621229
asked Mar 3 '18 at 7:58
Amir Hossein KhajeganAmir Hossein Khajegan
3111
3111
I assume you are using Xamarin Forms? Please post the line of code that is throwing the error. I think your issue is that you need to change it toLoadApplication(new PCLNameHere.App())
– Tristan
Mar 3 '18 at 8:36
I tried that , but it falls into error on line LoadApplication(new App()); The important point is , when i changed Linking option to none and unchecked ProGuard option , my applicatrion run successfully. I need those options to decrease my final .apk file
– Amir Hossein Khajegan
Mar 3 '18 at 8:49
What does the rest of the stacktrace say?
– hvaughan3
Mar 3 '18 at 16:27
Linking against SDK assemblies only isn't enough?
– hichame.yessou
Mar 4 '18 at 1:23
@hvaughan3 The value of my Environment.StackTrace is : at System.Environment.get_StackTrace () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception ex) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Object.d09f62bf-1e4f-438b-810e-1b2febfe5330 (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
– Amir Hossein Khajegan
Mar 4 '18 at 12:46
|
show 3 more comments
I assume you are using Xamarin Forms? Please post the line of code that is throwing the error. I think your issue is that you need to change it toLoadApplication(new PCLNameHere.App())
– Tristan
Mar 3 '18 at 8:36
I tried that , but it falls into error on line LoadApplication(new App()); The important point is , when i changed Linking option to none and unchecked ProGuard option , my applicatrion run successfully. I need those options to decrease my final .apk file
– Amir Hossein Khajegan
Mar 3 '18 at 8:49
What does the rest of the stacktrace say?
– hvaughan3
Mar 3 '18 at 16:27
Linking against SDK assemblies only isn't enough?
– hichame.yessou
Mar 4 '18 at 1:23
@hvaughan3 The value of my Environment.StackTrace is : at System.Environment.get_StackTrace () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception ex) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Object.d09f62bf-1e4f-438b-810e-1b2febfe5330 (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
– Amir Hossein Khajegan
Mar 4 '18 at 12:46
I assume you are using Xamarin Forms? Please post the line of code that is throwing the error. I think your issue is that you need to change it to
LoadApplication(new PCLNameHere.App())
– Tristan
Mar 3 '18 at 8:36
I assume you are using Xamarin Forms? Please post the line of code that is throwing the error. I think your issue is that you need to change it to
LoadApplication(new PCLNameHere.App())
– Tristan
Mar 3 '18 at 8:36
I tried that , but it falls into error on line LoadApplication(new App()); The important point is , when i changed Linking option to none and unchecked ProGuard option , my applicatrion run successfully. I need those options to decrease my final .apk file
– Amir Hossein Khajegan
Mar 3 '18 at 8:49
I tried that , but it falls into error on line LoadApplication(new App()); The important point is , when i changed Linking option to none and unchecked ProGuard option , my applicatrion run successfully. I need those options to decrease my final .apk file
– Amir Hossein Khajegan
Mar 3 '18 at 8:49
What does the rest of the stacktrace say?
– hvaughan3
Mar 3 '18 at 16:27
What does the rest of the stacktrace say?
– hvaughan3
Mar 3 '18 at 16:27
Linking against SDK assemblies only isn't enough?
– hichame.yessou
Mar 4 '18 at 1:23
Linking against SDK assemblies only isn't enough?
– hichame.yessou
Mar 4 '18 at 1:23
@hvaughan3 The value of my Environment.StackTrace is : at System.Environment.get_StackTrace () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception ex) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Object.d09f62bf-1e4f-438b-810e-1b2febfe5330 (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
– Amir Hossein Khajegan
Mar 4 '18 at 12:46
@hvaughan3 The value of my Environment.StackTrace is : at System.Environment.get_StackTrace () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception ex) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Object.d09f62bf-1e4f-438b-810e-1b2febfe5330 (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
– Amir Hossein Khajegan
Mar 4 '18 at 12:46
|
show 3 more comments
2 Answers
2
active
oldest
votes
As per: The type or namespace 'App' does not exist in the current namespace
Clean the solution
Build the PCL
Remove the PCL reference from the affected project(s)
Re-add the PCL reference
Build
I tried this solution and it works.
add a comment |
Take a look at your App.xaml.cs file.
If you have a "InitializeComponent does not exist in the current context error", this is likely caused by a known VS bug.
Solution:
- Right click on App.xaml.cs and select Properties.
- Change the Build Action to "Content".
- Apply.
- Change Build Action back to C# Compiler.
- Clean Solution.
- Build and Deploy.
I did it before but that error is persist exists
– Amir Hossein Khajegan
Jul 14 '18 at 17:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49082024%2ferror-on-loadapplication-in-xamarin-forms-pcl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As per: The type or namespace 'App' does not exist in the current namespace
Clean the solution
Build the PCL
Remove the PCL reference from the affected project(s)
Re-add the PCL reference
Build
I tried this solution and it works.
add a comment |
As per: The type or namespace 'App' does not exist in the current namespace
Clean the solution
Build the PCL
Remove the PCL reference from the affected project(s)
Re-add the PCL reference
Build
I tried this solution and it works.
add a comment |
As per: The type or namespace 'App' does not exist in the current namespace
Clean the solution
Build the PCL
Remove the PCL reference from the affected project(s)
Re-add the PCL reference
Build
I tried this solution and it works.
As per: The type or namespace 'App' does not exist in the current namespace
Clean the solution
Build the PCL
Remove the PCL reference from the affected project(s)
Re-add the PCL reference
Build
I tried this solution and it works.
answered Apr 26 '18 at 1:57
DiomedesDiomedes
344618
344618
add a comment |
add a comment |
Take a look at your App.xaml.cs file.
If you have a "InitializeComponent does not exist in the current context error", this is likely caused by a known VS bug.
Solution:
- Right click on App.xaml.cs and select Properties.
- Change the Build Action to "Content".
- Apply.
- Change Build Action back to C# Compiler.
- Clean Solution.
- Build and Deploy.
I did it before but that error is persist exists
– Amir Hossein Khajegan
Jul 14 '18 at 17:24
add a comment |
Take a look at your App.xaml.cs file.
If you have a "InitializeComponent does not exist in the current context error", this is likely caused by a known VS bug.
Solution:
- Right click on App.xaml.cs and select Properties.
- Change the Build Action to "Content".
- Apply.
- Change Build Action back to C# Compiler.
- Clean Solution.
- Build and Deploy.
I did it before but that error is persist exists
– Amir Hossein Khajegan
Jul 14 '18 at 17:24
add a comment |
Take a look at your App.xaml.cs file.
If you have a "InitializeComponent does not exist in the current context error", this is likely caused by a known VS bug.
Solution:
- Right click on App.xaml.cs and select Properties.
- Change the Build Action to "Content".
- Apply.
- Change Build Action back to C# Compiler.
- Clean Solution.
- Build and Deploy.
Take a look at your App.xaml.cs file.
If you have a "InitializeComponent does not exist in the current context error", this is likely caused by a known VS bug.
Solution:
- Right click on App.xaml.cs and select Properties.
- Change the Build Action to "Content".
- Apply.
- Change Build Action back to C# Compiler.
- Clean Solution.
- Build and Deploy.
answered Jul 13 '18 at 13:33
WilhelmWilhelm
676
676
I did it before but that error is persist exists
– Amir Hossein Khajegan
Jul 14 '18 at 17:24
add a comment |
I did it before but that error is persist exists
– Amir Hossein Khajegan
Jul 14 '18 at 17:24
I did it before but that error is persist exists
– Amir Hossein Khajegan
Jul 14 '18 at 17:24
I did it before but that error is persist exists
– Amir Hossein Khajegan
Jul 14 '18 at 17:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49082024%2ferror-on-loadapplication-in-xamarin-forms-pcl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I assume you are using Xamarin Forms? Please post the line of code that is throwing the error. I think your issue is that you need to change it to
LoadApplication(new PCLNameHere.App())
– Tristan
Mar 3 '18 at 8:36
I tried that , but it falls into error on line LoadApplication(new App()); The important point is , when i changed Linking option to none and unchecked ProGuard option , my applicatrion run successfully. I need those options to decrease my final .apk file
– Amir Hossein Khajegan
Mar 3 '18 at 8:49
What does the rest of the stacktrace say?
– hvaughan3
Mar 3 '18 at 16:27
Linking against SDK assemblies only isn't enough?
– hichame.yessou
Mar 4 '18 at 1:23
@hvaughan3 The value of my Environment.StackTrace is : at System.Environment.get_StackTrace () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception ex) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Object.d09f62bf-1e4f-438b-810e-1b2febfe5330 (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
– Amir Hossein Khajegan
Mar 4 '18 at 12:46