András Tóth‘s professional blog
banditoth.net

Hey there 👋, I’m banditoth a .NET MAUI developer from Hungary.
I write about software development with .NET technologies.

You can find me on:
LinkedIn | Github | StackOverflow | X / Twitter | Threads

Tag: error

  • Xamarin.UWP deployment failure: 0x80073D1F

    This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.
    Registering the application to run from layout...
    DEP0700: Registration of the app failed. [0x80073D1F] 
    	DeploymentSucceeded = False
    	DeploymentError = Err_Deploy_Register
    	DeploymentUserError = False
    	DeploymentHRESULT = 2147958047
    	HasSharedCode = False
    	Target.Id = 512
    	ProjectGuid = {5894aed2-9bb1-434b-8b49-3b86572709b7}
    	Project.TargetPlatformVersion = 10.0.19041.0
    	Project.TargetPlatformMinVersion = 10.0.17763.0
    Deleting file "vs.appxrecipe" from layout...
    DeployAsync: END (Failure, 0:00:01.499)
    Deploy: END (Failure, 0:00:01.5)
    

    Solution

    Remove your application source code from shared folder
    or
    You are being signed in with my Microsoft account in windows instead of the local user account
    or
    Visual Studio is not able to delete the application data in your local packages folder, go to C:\Users\<YOURNAME>\AppData\Local\Packages\ folder, and delete your applications folder manually.
    or
    browse more solution at here
    🙂

  • dotnet tool/workload installation fails, because of custom NuGet sources

    This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

    If you are facing this issue when using dotnet’s workload install, or tool install:

    Workload installation failed: Unable to load the service index for source https://pkgs.dev.azure.com/SourceNAME/_packaging/ProjectName/nuget/v3/index.json.
    

    Then you probably should invoke the command with the following parameter:

    --ignore-failed-sources
    

    Hope this helps 😉

  • Xamarin Forms: White screen between page push and pop solved

    This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

    If you are experiencing white screen when pushing to Navigation or Modal stack on Android, read on.

    I’m not sure is this a bug in Xamarin Forms or not, but I guess this is, because it comes only in certain scenarios, and not always.

    What is happening, how do you notice this error?

    You have got a NavigationPage. You are pushing a new page to the navigationstack, and the page is not getting rendered, only a blank white screen displays.

    If you are rotating the device, the page is getting rendered well.

    My environment was:
    Xamarin.Forms: 4.8 up to 5.0
    Device: Samsung Galaxy A12
    Visual Studio 2019 Professional with Xamarin.Android SDK 11.4.0.5

    Solution

    Always invoke the INavigation’s methods on the applications Main Thread. UI changes must go always on the UI thread of the application.

    Create a class which wraps the INavigation presented by your Views. It’s handy to store a reference in this class to the Applications Current MainPage’s INavigation instance, so try to build your code to supply the actual INavigation Instance every time to this class when the application’s mainpage is set.

    	public class NavigationDispatcher : INavigation
    	{
    		private INavigation _navigation;
    
    		public IReadOnlyList<Page> ModalStack => _navigation?.ModalStack;
    
    		public IReadOnlyList<Page> NavigationStack => _navigation?.NavigationStack;
    
    		private void SetNavigation(INavigation navigation)
    		{
    			_navigation = navigation;
    		}
    
    		public void InsertPageBefore(Page page, Page before)
    		{
    			_ = Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(() =>
    			  {
    				  _navigation.InsertPageBefore(page, before);
    			  });
    		}
    
    		public Task<Page> PopAsync()
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				return await _navigation.PopAsync();
    			});
    		}
    
    		public Task<Page> PopAsync(bool animated)
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				return await _navigation.PopAsync(animated);
    			});
    		}
    
    		public Task<Page> PopModalAsync()
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				return await _navigation.PopModalAsync();
    			});
    		}
    
    		public Task<Page> PopModalAsync(bool animated)
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				return await _navigation.PopModalAsync(animated);
    			});
    		}
    
    		public Task PopToRootAsync()
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				await _navigation.PopToRootAsync();
    			});
    		}
    
    		public Task PopToRootAsync(bool animated)
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				await _navigation.PopToRootAsync(animated);
    			});
    		}
    
    		public Task PushAsync(Page page)
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				await _navigation.PushAsync(page);
    			});
    		}
    
    		public Task PushAsync(Page page, bool animated)
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				await _navigation.PushAsync(page, animated);
    			});
    		}
    
    		public Task PushModalAsync(Page page)
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				await _navigation.PushModalAsync(page);
    			});
    		}
    
    		public Task PushModalAsync(Page page, bool animated)
    		{
    			return Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
    			{
    				await _navigation.PushModalAsync(page, animated);
    			});
    		}
    
    		public void RemovePage(Page page)
    		{
    			_ = Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(() =>
    			  {
    				  _navigation.RemovePage(page);
    			  });
    		}
    	}
    
    

    Remarks

    Consider a check for the current thread in the methods body.
    If they are being executed in the main thread, you won’t need to switch to the main again
    .

    Bug is reported on Github: https://github.com/xamarin/Xamarin.Forms/issues/11993

  • Docker error: CTC1014 Docker command failed with exit code 1.

    This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

    If you are facing the issue with the following error:

    CTC1014	Docker command failed with exit code 1.
    The command 'cmd /S /C dotnet restore "projectname.csproj"' returned a non-zero code: 1
    

    Ensure that you have selected Debug mode instead of Release.

  • .NET Core: UseUrls seems getting ignored error

    This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

    If you are facing the issue, that the Host.CreateDefaultBuilder’s ConfigureWebHostDefaults’s UseUrls method is getting ignored, and all the environment variables and launchsettings.json completly getting ignored by the .NET core application, its always using the default port of http : 5000 and the https 5001, follow the instructions

    Are you using configuration builder before calling the configurewebhostdefaults?

    				ConfigurationBuilder cfgBuilder = new ConfigurationBuilder();
    				cfgBuilder.AddEnvironmentVariables("CONFIGPREFIX_");
    				IConfigurationRoot configuration = cfgBuilder.Build();
    

    And are you passing the built configuration to ConfigureAppConfiguration ? Like that:

    					.ConfigureAppConfiguration(builder =>
    					{
    						builder.Sources.Clear();
    						builder.AddConfiguration(configuration);
    					})
    

    Then remove the ConfigureAppConfiguration call, and it will work..

    No idea how to work around