How to solve MAUI Shell.SearchHandler crashes when running on IOS environment? - c#

In my Project I have setup a Shell.SearchHandler, it works perfectly when I run on Android Emulator but crashes when I trying to type something in the search bar when I running on IOS Emulator.
It keeps pointing system null reference and crash immediately. Any solution for this?
StudentModel.cs
public class StudentModel
{
public string Name { get; set; }
public string Email { get; set; }
}
StudentListViewModel.cs
public class StudentListViewModel
{
public static List<StudentModel> Students { get; private set; } = new List<StudentModel>();
public StudentListViewModel()
{
Students.Add(new StudentModel
{
Name = "asd",
Email = "asd#123.com",
});
Students.Add(new StudentModel
{
Name = "qwe",
Email = "qwe#123.com",
});
Students.Add(new StudentModel
{
Name = "ert",
Email = "rty#123.com",
});
}
}
StudentListView.Xaml
<Shell.SearchHandler>
<searchHandlers:StudentSearchHandler
DisplayMemberName="Name"
Students="{x:Static vm:StudentListViewModel.Students}">
</searchHandlers:StudentSearchHandler>
</Shell.SearchHandler>
StudentSearchHandler.cs
public class StudentSearchHandler : SearchHandler
{
public IList<StudentModel> Students { get; set; }
protected override void OnQueryChanged(string oldValue, string newValue)
{
base.OnQueryChanged(oldValue, newValue);
if (string.IsNullOrWhiteSpace(newValue))
{
ItemsSource = null;
}
else
{
ItemsSource = Students.Where(student => student.Name.ToLower().Contains(newValue.ToLower())).ToList();
}
}
protected override async void OnItemSelected(object item)
{
base.OnItemSelected(item);
}
}
How to solve this error? Thanks.
I tried to set a breakpoint to test on different emulators, Android emulator will execute
protected override void OnQueryChanged(string oldValue, string newValue){}
method, but when running on an IOS emulator will not go into this method.

That's a known issue on .NET Maui. You could follow this issue [iOS] Shell.SearchHandler crashes the app .
Additionally, you might use SearchBar as an alternative. For more info, you could refer to .NET Maui SearchBar.

Related

Visual studio when i try to add reference get this : Instance object set as constant

I dont know what does it say or how to fix it anyone has idea ?
I also have tried to add this plugin interface to another project but got same error.
So I think the problem is about this plugin setup.
Here is my interface below
using DEMIRBANKLIB;
namespace DPlugin
{
public interface DPlugin
{
public enum EVENTTYPE {GETPACKAGE,SENDPACKAGE,LOADTABLE }
public string Name { get; set; }
public string Description { get; set; }
public EventManager manager { get; set; }
public void Run();
}
public class EventManager
{
IPaket paket;
Dictionary<DPlugin.EVENTTYPE,EventDelegate> events = new Dictionary<DPlugin.EVENTTYPE,EventDelegate>();
public delegate void EventDelegate(IPaket paket);
public bool RegisterEvent(DPlugin.EVENTTYPE TYPE,EventDelegate del)
{
if (events[TYPE] == null)
events.Add(TYPE, del);
else
return false;
return true;
}
}
}
Here is the plugin i want to use.
using DPlugin;
using DEMIRBANKLIB;
namespace PaketEventP
{
public class PEP : DPlugin.DPlugin
{
public string Name { get; set; }
public string Description { get; set; }
public EventManager manager { get; set; }
public PEP()
{
Name = "Paket Eventi Plugin";
Description = "Paket eventleri ile bir şeyler yapcak";
manager = new EventManager();
}
public void Run()
{
manager.RegisterEvent(DPlugin.DPlugin.EVENTTYPE.GETPACKAGE, paketAlEvent);
}
public void paketAlEvent(IPaket paket)
{
MessageBox.Show(paket.detay);
}
}
}
I solved this by editing solution codes manually.

Nested one-to-many tables SQLite-Net Extensions [duplicate]

I am trying to use SQLite-Net Extensions to create a Relational Database. I'm running into an issue when trying to pull the Term object from the database. It successfully pulls over its associated courses, but not the courses associated assessments and notes. I'm not sure if the problem lies in how I insert the objects into the database, how I pull the objects from the database, or how I have the objects attributes listed.
I feel like the SQLite-Net Extensions documentation is extremely limited, so I'm not even sure what's going on. I've tried it many different ways, including adding CascadeOperations, but non of those seemed to help.
Here is the (simplified) code for my objects:
[Table("Terms")]
public class Term
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public string Name { get; set; }
[OneToMany]
public List<Course> Courses { get; set; }
public Term() { }
public Term(string name, List<Course> courses)
{
Name = name;
Courses = courses;
}
Courses
[Table("Courses")]
public class Course
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[ForeignKey(typeof(Term))]
public int TermID { get; set; }
public string Name { get; set; }
[OneToMany]
public List<Assessment> Assessments { get; set; }
[OneToMany]
public List<Note> Notes { get; set; }
public Course() { }
public Course(string name, List<Assessment> assessments, List<Note> notes)
{
Name = name;
Assessments = assessments;
Notes = notes;
}
}
Assessments
[Table("Assessments")]
public class Assessment
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[ForeignKey(typeof(Course))]
public int CourseID { get; set; }
public string Name { get; set; }
public Assessment() { }
public Assessment(string name)
{
Name = name;
}
}
Notes
[Table("Notes")]
public class Note
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[ForeignKey(typeof(Course))]
public int CourseID { get; set; }
public string Name { get; set; }
public string Text { get; set; }
public Note() { }
public Note(string name, string note)
{
Name = name;
Text = note;
}
}
And here is the code for inserting and getting objects:
Inserting
public bool SaveTermAsync(Term term)
{
if (term.ID != 0)
{
_database.UpdateWithChildrenAsync(term);
return true;
}
else
{
foreach (var course in term.Courses)
{
foreach (var assessment in course.Assessments)
{
_database.InsertAsync(assessment);
}
foreach (var note in course.Notes)
{
_database.InsertAsync(note);
}
_database.InsertAsync(course);
}
_database.InsertAsync(term);
_database.UpdateWithChildrenAsync(term);
return false;
}
}
Getting
public Task<List<Term>> GetTermsAsync()
{
return _database.GetAllWithChildrenAsync<Term>();
}
I know it's a bit of a code dump, but I have no idea where or what could be going wrong. If anyone could give any information about what is potentially going wrong, that would be awesome. Perhaps I'm simply expecting something to happen that isn't actually how it works. I don't know.
Also, if anyone has any links to some better documentation than https://bitbucket.org/twincoders/sqlite-net-extensions/src/master/ that would be awesome
EDIT
I tried using Cascading Options as well, CascadeRead, CascadeInsert, and CascadeAll. Using CascadeInsert or CascadeAll with _database.InsertWithChildrenAsync(term, true) resulted in a crash. The crash does not provide any error messages, and even wrapping the InsertWithChildren with a try catch block didn't work. Removing the recursive bool caused the program not to crash, and actually get the closest to what I'm looking for. Assessments and Notes are no longer null, but are still empty. Here's my updated code:
Saving and Getting:
public async Task<List<Term>> GetTermsAsync()
{
return await _database.GetAllWithChildrenAsync<Term>(recursive: true);
}
public async void SaveTermAsync(Term term)
{
if (term.ID != 0)
{
await _database.UpdateWithChildrenAsync(term);
}
else
{
//Trying this with recursion results in crash
await _database.InsertWithChildrenAsync(term);
}
}
One-To-Many Relationships:
//In Term
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Course> Courses { get; set; }
//In Courses
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Assessment> Assessments { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Note> Notes { get; set; }
Also, I forgot to include last time how I'm populating the tables in the first place.
public bool CreateTables()
{
_database.CreateTableAsync<Term>().Wait();
_database.CreateTableAsync<Course>().Wait();
_database.CreateTableAsync<Assessment>().Wait();
_database.CreateTableAsync<Note>().Wait();
return true;
}
public Task<int> ClearTablesTest()
{
_database.DropTableAsync<Term>();
_database.DropTableAsync<Course>();
_database.DropTableAsync<Assessment>();
return _database.DropTableAsync<Note>();
}
async public Task<int> PopulateTestData()
{
await ClearTablesTest();
CreateTables();
Term term = new Term("Test Term", true, DateTime.Now, DateTime.Now.AddDays(10),
new List<Course>
{
new Course("Test Course", CourseStatus.Completed, "Guys Name", "(999)-999-9999", "email#gmail.com", 6, DateTime.Now, DateTime.Now.AddDays(10),
new List<Assessment>
{
new Assessment("Test Assessment", AssessmentType.Objective, false, DateTime.Now, DateTime.Now.AddDays(10))
},
new List<Note>
{
new Note("Test Note", "This is a test note.")
})
});
App.Database.SaveTermAsync(term);
return 0;
}
I finally figured out what was causing the crash as well as causing general confusion within SQLite-Net Extensions.
In my Assessment class, the property
public string BackgroundColor
{
get { return IsComplete ? "#558f45" : "Gray"; }
set { BackgroundColor = value; }
}
was causing the crash when recursion was used. I've been scouring the web for over two weeks looking for solutions to this issue, but haven't found anything similar to this. I submitted a bug report on the SQLite-Net Extensions bitbucket.
If anyone knows why this specific line would cause issues, I'd love to hear your input. Until then I'm going to mark this question as answered and continue work on my app.
Thanks #redent84 for your help thus far on this issue.

SQLite-Net-Extensions GetWithChildren() Method only reaches first Child Layer

currently I am working with the NuGet SQLite-Net-Extensions in Xamarin Forms and I have encountered a problem for which I can't find a solution.
The Problem: When calling GetWithChildren(primaryKey, recursive: true), the returned object only contains the first child layer. An example can be seen in the following.
The database is built up like this:
The equivalent code to this model is provided in the following:
User
namespace DatabaseTest
{
[Table("Users")]
public class User
{
[PrimaryKey,AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
[OneToMany]
public List<Contact> Contacts { get; set; }
}
}
Contact
namespace DatabaseTest
{
[Table("Contacts")]
public class Contact
{
[PrimaryKey,AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
[OneToMany]
public List<Entry> Entries { get; set; }
[ForeignKey(typeof(User))]
public int UserID { get; set; }
[ManyToOne]
public User User { get; set; }
}
}
Entry
namespace DatabaseTest
{
[Table("Entries")]
public class Entry
{
[PrimaryKey,AutoIncrement]
public int Id { get; set; }
public float Amount { get; set; }
[ForeignKey(typeof(Contact))]
public int ContactId { get; set; }
[ManyToOne]
public Contact Contact { get; set; }
}
}
In my App.cs I am creating the database and use the CreateTable() Method for all three classes. For the sake of this example, in MainPage.xaml.cs there is simply a button, which has a ButtonClicked Method.
In the real Application a process could look like this:
User logs in --> Adds Contact --> At some Point User creates Entry to one of his contacts
To accomplish this procedure in my example, the ButtonClicked Method looks like this:
void ButtonClicked(object sender, EventArgs e)
{
try
{
User user = new User()
{
Name = "Test user"
};
Contact contact = new Contact()
{
Name = "First contact"
};
Entry entry1 = new Entry()
{
Amount = 10F
};
Entry entry2 = new Entry()
{
Amount = 20F
};
App.Database.Insert(user);
if (user.Contacts==null)
{
user.Contacts = new List<Contact>();
}
App.Database.Insert(contact);
user.Contacts.Add(contact);
App.Database.UpdateWithChildren(user);
if (contact.Entries==null)
{
contact.Entries = new List<Entry>();
}
App.Database.Insert(entry1);
App.Database.Insert(entry2);
contact.Entries.Add(entry1);
contact.Entries.Add(entry2);
App.Database.UpdateWithChildren(contact);
App.Database.UpdateWithChildren(user);
var test = App.Database.GetWithChildren<User>(user.Id, recursive: true);
var test2 = App.Database.GetAllWithChildren<Contact>();
var test3 = App.Database.GetAllWithChildren<Entry>();
} catch (Exception ex)
{
Debug.Print(ex.Message);
}
}
I have set a breakpoint to the bracket that closes the try to inspect the result. In the End, my user looks like this:
Which is absolutely perfect.
However, when I try to get this user from my database, the result looks like this:
I don't know how to resolve this error and hope anyone can help me with this problem.
Since this post is very long already, I thank everyone who read this far in advance.
After many tries I finally solved my problem on my own.
Solution:
It could not have been any easier. In my User, Contact and Entry Class I provided my OneToMany and ManyToOne attributes with the CascadeOperation attribute. Example:
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Entry> Entries { get; set; }
[ManyToOne(CascadeOperations = CascadeOperation.All)]
public User User { get; set; }
Even though I marked my GetWithChildren() Method as recursive: true, only by applying CascadeOperations it will work properly. More information about SQLite-Net-Extensions and CascadeOperations can be found here:
Source: TwinCoders SQLite-Net-Extensions

Entity Framework Core error not seen before Class.TempProperty is of type 'object' which is not supported by current database provider

I am using Entity Framework Core code-first with fluent API entity configurations, in an ASP .NET MVC Core application. My code currently compiles, but when I run add-migration in the Package Manager Console, it gives the error below:
The property 'Exam.TempId' is of type 'object' which is not supported
by current database provider. Either change the property CLR type or
manually configure the database type for it.
Searching Google for this error yields no results. Can anybody here help please?
"Exam" is a class in my domain model, but it doesn't have a "TempId" property so I guess that's something that Entity Framework is adding. It does have an "Id" property, but the type is int, not object.
I'll start by sharing the Exam class and the Exam configuration class. I can share more code if required. I'd be really grateful for any advice you can provide to resolve the problem.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace MySite.Core.Models
{
public class Exam : ActivatableEntity
{
private int _numberOfQuestionsToBeAttempted;
private Exam()
{
Topics = new Collection<Topic>();
}
public Exam(IUser createdByUser,
string name,
string description,
double timeAllowedInMinutes,
bool shuffleTopicsTogether = true) :
base(createdByUser)
{
Name = name;
Description = description;
Topics = new Collection<Topic>();
TimeAllowedInMinutes = timeAllowedInMinutes;
ShuffleTopicsTogether = shuffleTopicsTogether;
}
public string Name { get; private set; }
public string Description { get; private set; }
public double TimeAllowedInMinutes { get; private set; }
public bool ShuffleTopicsTogether { get; private set; }
public IEnumerable<Question> PossibleQuestions
{
get
{
return Topics.SelectMany(t => t.PossibleQuestions);
}
}
public int NumberOfQuestionsToBeAttempted
{
get
{
if (_numberOfQuestionsToBeAttempted != 0) return _numberOfQuestionsToBeAttempted;
foreach (Topic topic in Topics)
{
_numberOfQuestionsToBeAttempted += topic.NumberOfQuestionsToBeAttempted;
}
return _numberOfQuestionsToBeAttempted;
}
}
public IEnumerable<Topic> Topics { get; }
public void Update(IUser updatedByUser, string name, string description, double timeAllowedInMinutes, bool shuffleTopicsTogether = true)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Description = description;
TimeAllowedInMinutes = timeAllowedInMinutes;
ShuffleTopicsTogether = shuffleTopicsTogether;
Update(updatedByUser);
}
}
}
Exam configuration class
using MySite.Core.Models;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace MySite.Persistence.EntityConfiguration
{
public class ExamConfiguration
{
public ExamConfiguration(EntityTypeBuilder<Exam> entityBuilder)
{
entityBuilder.HasKey(e => e.Id);
entityBuilder.HasOne(e => (ApplicationUser)e.CreatedByUser)
.WithMany()
.HasForeignKey(e => e.CreatedByUserId)
.OnDelete(DeleteBehavior.SetNull);
entityBuilder.HasOne(e => (ApplicationUser)e.LastUpdatedByUser)
.WithMany()
.HasForeignKey(e => e.LastUpdatedByUserId)
.OnDelete(DeleteBehavior.SetNull);
entityBuilder.Property(e => e.Name).IsRequired().HasMaxLength(50);
entityBuilder.Property(e => e.Description).IsRequired().HasMaxLength(250);
entityBuilder.HasMany(e => e.Topics)
.WithOne(t => t.Exam).OnDelete(DeleteBehavior.Cascade);
}
}
}
As requested by posters, I'm adding the code for the base classes below:
using System;
namespace MySite.Core.Models
{
public abstract class ActivatableEntity :
UpdatableCreatableEntity,
IActivatable
{
protected ActivatableEntity() { }
protected ActivatableEntity(IUser createdByUser) : base(createdByUser) { }
public int? LastActivatedByUserId { get; private set; }
public IUser LastActivatedByUser { get; private set; }
public DateTime? WhenLastActivated { get; private set; }
public int? LastDeactivatedByUserId { get; private set; }
public IUser LastDeactivatedByUser { get; private set; }
public DateTime? WhenLastDeactivated { get; private set; }
public bool IsActive { get; private set; }
protected virtual void Activate(IUser activatedByUser)
{
LastActivatedByUser = activatedByUser ?? throw new ArgumentNullException(nameof(activatedByUser));
LastActivatedByUserId = activatedByUser.Id;
WhenLastActivated = DateTime.Now;
IsActive = true;
}
protected virtual void Deactivate(IUser deactivatedByUser)
{
LastDeactivatedByUser = deactivatedByUser ?? throw new ArgumentNullException(nameof(deactivatedByUser));
LastDeactivatedByUserId = deactivatedByUser.Id;
WhenLastDeactivated = DateTime.Now;
IsActive = false;
}
}
public abstract class UpdatableCreatableEntity :
CreatableEntity,
IUpdatable
{
protected UpdatableCreatableEntity() { }
protected UpdatableCreatableEntity(IUser createdByUser) : base(createdByUser) { }
public int? LastUpdatedByUserId { get; private set; }
public IUser LastUpdatedByUser { get; private set; }
public DateTime? WhenLastUpdated { get; private set; }
protected virtual void Update(IUser updatedByUser)
{
LastUpdatedByUser = updatedByUser ?? throw new ArgumentNullException(nameof(updatedByUser));
LastUpdatedByUserId = updatedByUser.Id;
WhenLastUpdated = DateTime.Now;
}
}
public abstract class CreatableEntity :
IIdentifiable,
ICreatable
{
protected CreatableEntity() { }
protected CreatableEntity(IUser createdByUser)
{
CreatedByUser = createdByUser ?? throw new ArgumentNullException(nameof(createdByUser));
CreatedByUserId = createdByUser.Id;
WhenCreated = DateTime.Now;
}
public int Id { get; private set; }
public int? CreatedByUserId { get; private set; }
public DateTime WhenCreated { get; private set; }
public IUser CreatedByUser { get; private set; }
}
}
I faced same problem and it confused me a lot. But luckily I was using version control, so I was able to trace reasons of the issue.
For me it was many-to-many relation entity model with constructor that assigns values to fields. I was relying to Visual Studio to generate properties for me automatically, and VS did poor job not detecting type of the property that later became a key.
VS created property of type object, which is too generic and hardly could be translated into underlying database abstractions. Hence the error.
I agree, quite not descriptive, hope they will fix that in future versions.
So try to search for properties of object type and check, are they used as keys, if yes, try to replace them with specific types supported by your database provider.
Reported error for developers: #9817.

c#.net COM dll breaks reference with vb6 application

I have a DLL written in C#.NET which exposes a COM interface, so a vb6 application can call my DLL. This interface looks like:
[System.Runtime.InteropServices.Guid("3D2C106C-097F-4ED7-9E4F-CDBC6A43BDC4")]
public interface IZDPharmaManager {
[System.Runtime.InteropServices.DispId(2)]
SearchPatientEventArgs FoundPatient { get; set; }
[System.Runtime.InteropServices.DispId(3)]
IntPtr Start(string server, string database, string user, string password, bool integrated, int praktijkID, string userGUID, int userID, string userName, bool hasRightToSearchPatient);
[System.Runtime.InteropServices.DispId(4)]
void Stop();
[System.Runtime.InteropServices.DispId(5)]
void InitializeSkinner(System.Object skinnerFramework);
}
[System.Runtime.InteropServices.Guid("4438852E-CF2D-4DB0-8E6E-428F65A6B16C")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IZDPharmaManagerEvents {
[DispId(1)]
void SearchPatient(ZDPharmaManager sender, SearchPatientEventArgs e);
}
[System.Runtime.InteropServices.Guid("9297D43F-C581-3F0F-AA60-9506C6B77B5F")]
[ClassInterface(ClassInterfaceType.None)]
public class SearchPatientEventArgs : WebHIS.ZDPharmaceutisch.ISearchPatientEventArgs {
public SearchPatientEventArgs() {
//Nodig voor COM.
}
public int ID { get; set; }
public string FullName { get; set; }
public string OwnName { get; set; }
public string PartnerName { get; set; }
public string DateOfBirth { get; set; }
public string ZipCode { get; set; }
public string HouseNumber { get; set; }
public string BSN { get; set; }
}
public delegate void SearchPatientEventHandler(ZDPharmaManager sender, SearchPatientEventArgs e);
[System.Runtime.InteropServices.Guid("465AC7EC-27EF-3D95-AAA6-29D01FCF15A1")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IZDPharmaManagerEvents))]
public class ZDPharmaManager : WebHIS.ZDPharmaceutisch.IZDPharmaManager {
public event SearchPatientEventHandler SearchPatient = null;
public SearchPatientEventArgs FoundPatient { get; set; }
//private MainForm GraphicalInterface { get; set; }
private ChoosePatient GraphicalInterface { get; set; }
public ZDPharmaManager() {
//Nodig voor COM.
}
#region IZDPharmaManager Members
public IntPtr Start(string server,
string database,
string user,
string password,
bool integrated,
int praktijkID,
string userGUID,
int userID,
string userName,
bool hasRightToSearchPatient) {
//Zet connectiestring.
DAL.DAC.CnnInfo = new System.Data.SqlClient.SqlConnectionStringBuilder() {
DataSource = server,
InitialCatalog = database,
UserID = user,
Password = password,
IntegratedSecurity = integrated
};
DAL.DAC.PracticeID = praktijkID;
DAL.DAC.UserGUID = userGUID;
DAL.DAC.UserID = userID;
DAL.DAC.UserName = userName;
DAL.DAC.HasRightToSearchPatient = hasRightToSearchPatient;
//Apotheek IDs ophalen en bewaren.
DAL.DAC.PharmacyIDs = DAL.PracticeDAO.GetPharmacyByPracticeID(praktijkID);
//Initialiseer grafische interface.
//this.GraphicalInterface = new MainForm();
this.GraphicalInterface = new ChoosePatient();
//Haal ongekoppelde afhaalberichten op.
this.GraphicalInterface.Patients = new VML.PatientsVM(this);
//Toon grafische interface.
this.GraphicalInterface.Show();
return this.GraphicalInterface.Handle;
}
public void Stop() {
foreach (var item in this.SearchPatient.GetInvocationList()) {
this.SearchPatient -= (SearchPatientEventHandler)item;
}
this.GraphicalInterface.Close();
this.GraphicalInterface = null;
this.FoundPatient = null;
}
public void InitializeSkinner(System.Object skinnerFramework) {
WebHIS.ZDPharmaceutisch.SkinnerModule.SkinFramework = (XtremeSkinFramework.SkinFramework)skinnerFramework;
}
#endregion
internal virtual void OnSearchPatient(SearchPatientEventArgs e) {
if (this.SearchPatient != null) {
this.SearchPatient(this, e);
}
}
}
This works fine. But each time I build this DLL without changing the interface (because I had to fix something somewhere in the logic) the reference with the vb6 application is broken and we need to recompile the vb6 application.
Does anyone know what I am doing wrong? 'Cause we had vb.net DLL's which didn't break the reference after recompile due to fixed GUIDs. Any help would be much appreciated.
Update
Both vb6 app and DLL are operational. But when I recompile the DLL and test it on our testserver via the vb6 application I get an automation error (which usually means the reference is broken and you need to recompile the vb6 app aswell)
I don't see any strong leads that could explain this problem. The [Guid] attribute for the assembly matters, that sets the type library ID. And the [AssemblyVersion] matters, that sets the type library version number. The attributes are declared in the project's AssemblyInfo.cs file. Make sure your build system doesn't monkey with these attributes.
Best way to go about it is to find out what exactly changes. Run the OleView.exe utility from the Visual Studio Command Prompt. File + View Typelib and select the .tlb file. Copy/paste the content of the right panel into a text file.
Rebuild the project and repeat the OleView exercise. You can now simply use a diffing tool to see what exactly changed. Update your question with what you found out if you need more help.

Categories

Resources