So I was implementing this nice notification system in a robot a little while ago, but first now tried to run it outside UiPath Studio using UI Robot, and I get an error I dont understand fully. I know it is about double reference to wpf but I have no clue how to fix it.
so here is the notification system I implemented:
Code of the Invoke Code
System.Windows.Forms.Application.Exit()
lblFname = New System.Windows.Forms.Label()
lblFname.AutoSize = True
lblFname.ForeColor = System.Drawing.Color.Black
lblFname.Location = New System.Drawing.Point(10, 10)
lblFname.Name = "lblFname"
lblFname.Size = New System.Drawing.Size(38, 13)
lblFname.TabIndex = 0
lblFname.Text = FullName.Trim
form= New System.Windows.forms.form
form.Text="TM Tand Opstart"
form.TopMost = True
form.AutoSize = False
form.BackColor = Color.FromArgb(255, 255, 255)
form.AutoScaleDimensions = New System.Drawing.SizeF(12F, 13F)
form.Font = New System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point)
form.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
form.ClientSize = New System.Drawing.Size(350, 75)
form.StartPosition = FormStartPosition.Manual
form.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - form.Width,
Screen.PrimaryScreen.WorkingArea.Height - form.Height)
form.Controls.Add(lblFname)
form.Name = "notoficationForm"
form.ControlBox = False
form.Show()
This is the error I get
Translation of line 2 to 4 from danish:
error BC2000: Initialization of the compiler failed unexpected:
There is already a reference to the assembly in the project.
Xceed.Wpf.AvalonDock.resources. Cannot add a new reference
I am 110% sure it is the invoke code. If I comment it out, save the code and run it from the UI Robot, I get no error and rest of the code runs fine
Here is what is imported in UI Path Studio, and I guess it is the invoke code and the import list that is colliding some how in the compiled version in UI Robot
So this means that it works when you run from Studio, but not from Robot tray? You said you have Community Edition, so the Robot cannot be installed separately on the machine.
Is your code in Invoke code activity the same as Vinay’s in the post you shared?
Can you share the xaml file?
@vvaidya what do you think? (because you are the one that first created this )
So this means that it works when you run from Studio, but not from Robot tray? You said you have Community Edition, so the Robot cannot be installed separately on the machine.
It is a full install of studio I’m just running the robot from a bat file with a parameter with the path to the XAML file. But yes it is the same as running it from the robot tray icon, it gives me the same error. It works fine when run from studio, the second I publish it and run it from tray or my bat file, it gives me the error.
Is your code in Invoke code activity the same as Vinay’s in the post you shared?
It is not 100% the same, but very close and to my knowledge, what I’ve edited should not cause this error.
I’ve uploaded a code that open up a notepad instead of the special program it was opening in my original code. This version also gives the same error as my original XAML Main.xaml (46.8 KB)
I don’t think I used that assembly in my code. Open your xaml file in notepad and look for that assembly and try removing it manually (line 28)
Seems like line 28 isn’t assembly but line 55 seems like that is where it starts?
Hi, I came across this post when I was trying to figure out the same issue.
I was able to fix the problem for me by using the “invoke method” activity instead of using the “invoke code” activity. I am not sure what is causing invoke code to fail.