Setting the MauiSplashScreen tag inside my net6.0 MyMauiProject.csproj pointing to a mp4 file makes it throw a null exception from Resizetizer/SkiaSharpBitmapTools. It looks like hardcoded trash from Microsoft. I don't even have a 'D:' drive on my machine, just 'C:', but the error points to D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpBitmapTools.cs:line 29 , a project I never created.
Was searching like a crazy on google, but there is nothing about it.
Even after it changes back to a gif and also changes to a svg, the error stays there.
Thinking about recreating the project and copying my source code to see if it fixes it, but I cant do it every time and that isn't a good solution.
I'm on a tight deadline project. I can't do in on Xamarin Forms because MS is discontinuing it and looks I can't do on MAUI too.
Severity Code Description Project File Line Suppression State
Error MAUI0000 System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Maui.Resizetizer.SkiaSharpBitmapTools.GetOriginalSize() in D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpBitmapTools.cs:line 29
at Microsoft.Maui.Resizetizer.SkiaSharpTools.Resize(DpiPath dpi, String destination) in D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpTools.cs:line 47
at Microsoft.Maui.Resizetizer.Resizer.Resize(DpiPath dpi, String inputsFile) in D:\a\1\s\src\SingleProject\Resizetizer\src\Resizer.cs:line 101
at Microsoft.Maui.Resizetizer.ResizetizeImages.ProcessImageResize(ResizeImageInfo img, DpiPath[] dpis, ConcurrentBag`1 resizedImages) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 172
at Microsoft.Maui.Resizetizer.ResizetizeImages.<>c__DisplayClass26_0.<ExecuteAsync>b__0(ResizeImageInfo img) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 88
at Microsoft.Maui.Resizetizer.AsyncTaskExtensions.<>c__DisplayClass0_0`1.<ParallelForEach>b__0(TSource s) in D:\a\1\s\src\SingleProject\Resizetizer\src\AsyncTaskExtensions.cs:line 21 MyMauiProject C:\Users\MySelf\.nuget\packages\microsoft.maui.resizetizer.sdk\6.0.101-preview.11.2349\build\Microsoft.Maui.Resizetizer.Sdk.targets 463
When clicking on the error, the IDE points to:
<!-- Resize the images -->
<ResizetizeImages
PlatformType="$(ResizetizerPlatformType)"
IntermediateOutputPath="$(_MauiIntermediateImages)"
InputsFile="$(_ResizetizerInputsFile)"
Images="#(MauiImage->Distinct())">
</ResizetizeImages>
I never ever touched on this block.
Closing and opening Visual Studio/Project doesnt fix it either.
It looks like it's pointing to here.
I had exactly the same issue. The problem was that I had a non-image file (ie a file called list.txt) in the Resources/Images folder.
Removing the file fixed the issue and the code ran correctly.
Another person had a related error here, the solution was reinstall all environment.
I Think you realized the error isnt with your code but with: C:\Users\MySelf\.nuget\packages\microsoft.maui.resizetizer.sdk\6.0.101-preview.11.2349
I would create an Android App where I can show geo data and other things.
I implement Android.Gms.Maps and would change the default ping icon of a marker into an dot.
I tried different ways but nothing worked for me...please help me!
attempt 1: (Open the bmp icon from path)
_myPositionMarker = _map.AddMarker(new MarkerOptions()
.SetPosition(new LatLng(34.8094, 12.7484))
.SetTitle("Actual Position")
.SetIcon(BitmapDescriptorFactory.FromPath("C:\\Users\\my.name\\source\\repos\\repo\\appName\\Resources\\drawable\\dot.bmp")));
error message: failed to decode image, must be a bitmap
attempt 2: (I have included the bmp file as embedded resource)
_myPositionMarker = _map.AddMarker(new MarkerOptions()
.SetPosition(new LatLng(34.8094, 12.7484))
.SetTitle("Actual Position")
.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.dot)));
error message: the app did'nt compile but no failure is shown
attempt 3: (also as resource)
var markerImg = BitmapDescriptorFactory.FromResource(Resource.Drawable.dot);
_myPositionMarker = _map.AddMarker(new MarkerOptions()
.SetPosition(new LatLng(34.8094, 12.7484))
.SetTitle("Actual Position")
.SetIcon(markerImg));
error message: the app did'nt compile but no failure is shown
nothing worked! I have no idea to solve the problem :-/
to be sure...
_myPositionMarker = _map.AddMarker(new MarkerOptions()
.SetPosition(new LatLng(24.8094, 12.7484))
.SetTitle("Actual Position")
...shows the default marker correctly and the app work well
Thanks for helping!
Attempt 1 won't work as the path does not point at a path on the device itself.
Attempt 2 and 3 should work as long as the Drawable is not a VectorDrawable or XML based drawable. It needs to be an jpg or png.
These also can't be embedded resources, but have to be Android Resources, so they need to be in the appropriate Resources folder and Build Action set to AndroidResource.
Also make sure to add markers after the map ready callback has been called.
Simply put i added a new form to my program to see the data directly instead of just manipulating though SQL. well when i add the data set. and it does work in the designer perfectly but when i go to build it it erros out
Severity Code Description Project File Line
Error CS0426 The type name 'Db12DataSet' does not exist in the type 'AllianceERP' AllianceERP C:\Users\dhelm.ALLMATINC.001\Documents\Visual Studio 2013\Projects\AllianceERP\AllianceERP\Form2.Designer.cs 230
the line it is referencing is private AllianceERP.Db12DataSet db12DataSet;
with redline under db12DataSet
and i think that the problem is that db12data set isnt in that location but is in another location ? My connection string is right and tested #
connection.ConnectionString = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=S:\Documents\2015\Db12.accdb";
Where have I gone wrong or is my thinking just off?
i have picBarrier as a picturebox, for some reason, i keep getting an error about a background picturebox i deleted on something, it points it out for even when its commented out. i tried deleting-text, restarting, any suggestions?
Error 1 The name 'picBackGround' does not exist in the current contex
// PictureBox[] pics = {picBarrier, picEnd, picFloor;
I'm just gonna rep whore this one.... :>
Full Clean + Rebuild fixes this. You can tell that Visual Studio is a bit out of sync with the source because it's highlighting something completely different to what it says is the issue.
Clean + Rebuild (even though Rebuild does a Clean.. sometimes its very random in what it does.. so I always suggest a Clean + Rebuild):
I have a c# program which open *.postfix file.
If a user runs a (.lnk)shortcut which points to my type of file, my program will open the target.
So, how could my program know it is started by a (.lnk)shortcut (and get it's file path)?
In some circumstances,i need to replace the .lnk file.
Thanks!
Edited
First, thanks to guys who answered my question.
By following #Anders answer, i find out my problem lays here.
I made some changes to windows registry, so browser knows to throw customized protocol string to certain program.
some thing like this..
[InternetShortcut]
URL=myProtocol://abcdefg.....
That's maybe why i lost lpTitle. :(
I'm going to try this way:
Whenever my program invoked, of course fed with %1, program checks current opened explorer(Window), and try to get it's current path with IWebBrowserApp. With that path and desktop of course, scan and analyze *.lnk to determine which one to replace.
I think this will probably work, but not be sure. I will try.
continued
In native code you can call GetStartupInfo, if the STARTF_TITLEISLINKNAME bit is set in STARTUPINFO.dwFlags then the path to the .lnk is in STARTUPINFO.lpTitle. I don't know if there is a .NET way to get this info, you probably have to P/Invoke...
You don't. There's no way to do it. End of story.
So this has been brought to my attention due to a recent downvote. There's an accepted answer showing an idea that gets the path to the launching shortcut most of the time. However my answer is to the whole. OP wants the link to the shortcut so he can change it. That is what can't be done most of the time.
Most likely case is the shortcut file exists in the start menu but is unwritable. However other cases involve the shortcut coming from another launching application that didn't even read it from a disk but from a database (I've seen a lot of corporate level restricted application launch tools). I also have a program that launches programs from shortcuts not via IShellLink but by parsing the .lnk file (because it must not start COM for reasons) and launching the program contained. It doesn't pass STARTF_TITLEISLINKNAME because it's passing an actual title.
If you're using Visual Studio Setup Project to build an installer and do the file type association, you should follow these instructions http://www.dreamincode.net/forums/topic/58005-file-associations-in-visual-studio/
Open up your solution in Visual studio.
Add a Setup Project to your solution by file , add project,New project, Setup & Deployment projects,Setup project
Right-click on your setup project in the "Solution Explorer" window,Select view,then select file types.
you'll see the "file types" window displayed in Visual studio.At the top of the window will be "File types on target machine"
Right-click on "File types on target machine".the menu will pop up with Add "file type" Click on this.
you'll see "New document Type#1" added,and "&open"underneath it.
The "new document type#1" can be anything you want - change it to something descriptive.although the user never sees this,never use something common- be as unique as possible,Because you can overlay current file associations without even realizing it.For example,you might think"pngfile" might be a useful name- but using that will now send all"*.png" files to your application,instead of to an image viewer.A good practice maybe "YourCompantName.Filetype",where your company name is your name of your company's name, and "Filetype" is a descriptive text of your file.
In the "properties" window for your new type,you will need to change a few properties.:
Command:Change to the application that you want to run.If you click on the "..." and you will proberly want to locate and use the "primary Output..." File
Description: This is the description of the file type(if it doesn't describe it's self"
Extensions:This your list of extensions for you chosen Program.Separate each one with a ","
Icon:This will associate the icon with your file type,This shows up in the window explorer.
Now we move to that "&open ".This is an action that is available if your right-click on the file.The default action("&Open" is currently set as the default) is what happens when you double click on the file.Right click on your "New document type#1" to add actions,but for the moment,lets define our "&open" action
Click on "&Open".You will see in the properties window "Name","Arguments","Verbs". Verb is hidden from the user,but is the key that is stored in the registry.Leave it same as the name,But without the "&".The default for"Arguments" is "%1",Which means to pass the full path and filename to your application.You can add other stuff here as well,if you need to pass flags to your application to do special stuff.All this infomaton is getting passed to your application on the command line,so you'll need to be familiar with the "Environment.CommandLine" object.
If you need to set a different action as your default,just right click on the action and "set as default"
Basically, you'll pass the file path as an argument to your program. Then if it's a console application or Windows Forms , you should check the arguments in Program.Main
static void Main(string[] args)
{
//if file association done with Arguments %1 as per forum post above
//you file path should be in args[0]
string filePath = null;
if(args != null && args.Length > 0)
filePath = args[0];
}
For a WPF application you'll need to handle that in the StartUp event for your Application
void App_Startup(object sender, StartupEventArgs e)
{
string filePath = null;
if ((e.Args != null) && (e.Args.Length > 0))
{
filePath = e.Args[0];
}
}